Giix — Gii Extended

Dear folks,

Here comes giix.

giix on Google Code

giix is gii Extended, a code generator for Yii PHP framework.

giix is inspired and based on gii-template-collection (gtc), by Herbert Maschke (thyseus).


giix is inspired and uses code from Yii PHP framework and gii-template-collection. Many thanks to Qiang Xue, Herbert Maschke and the contributors of these software.


giix extends Yii’s gii by providing:

  • Proper handling of related model attributes, rendering appropriate form fields based on relation type.

  • More support for HAS_MANY and MANY_MANY relations.

  • Native support for saving MANY_MANY relations with the new method GxActiveRecord::saveWithRelated.

  • Native support for saving multiple (related or not) records with the new method GxActiveRecord::saveMultiple.

  • Automatic string representation for a model via GxActiveRecord::representingColumn() and GxActiveRecord::__toString().

  • Better i18n support and easier to maintain: support to active record labels. You change the label once in the model and it is automatically updated in the views. This is especially useful for plurals.

  • Out-of-the box i18n support by using Yii::t().

  • Appropriate form fields are rendered based on model attribute/table field data type.

  • Separated model and basemodel. Basemodel can be regenerated without overwriting your code in the model.

  • Smart methods can query your database for just the needed data (usually the primary key and the field with the string representantion), avoiding manual setup or a "select *".

  • Extensive use of default method parameters. Appropriate data is found automatically.

  • Some (incipient) support for tables with composite primary keys.

  • Generated code is completely free from styling and formatting. Your CSS controls the presentation.

  • Generated code is (almost) free of comments.

  • Well documented and commented source code. Ohloh says that 40% of the lines in the code are comments! You can understand and modify anything you want.

And a lot more! Read the CHANGELOG file and the (richly commented) source code to fully leverage giix’s power.

Some of these features come from gtc.

Installation and upgrading

Please see INSTALL and UPGRADE files for instructions.

Please check the README file for more information.

Already using giix?

Show how you love giix on this forum and on its extension page

Upvote giix

Show everybody that you are using giix in Powered by giix

Donate (see below)

[color="#808080"]If you have any trouble, please open a ticket in Google Code[/color]

[color="#808080"]Do you like giix? Then please let people know at[/color]

This extension is also a way to say thank you to the people who work on the free software I use everyday.

giix is a personal project turned into an extension. It is not fully tested now, so please test your application and be careful using it in production code.

If you are using it, please let me know about your opinion. And don’t forget to vote! :slight_smile:

[color="#808080"]Icons by[/color]

Why are there so many thumbs down or negative votes for this extension? Seems a bit pointless if people don’t know why a negative vote was entered.

Nothing I can see seems negative??


Beats me as well. ???

I think this is an excellent extension. :D

May I suggest that people are not allowed to thumb down without adding a comment.

Cowardly bastards…

I am definitely going to take this for a spin. ;)

First of all, thank you for your efforts.

When I tried to check the extension, I followed up your installation steps and got this error when I tried to create a GxModel


Parse error: syntax error, unexpected $end in

/----------/protected/extensions/giix-core/giixModel/templates/default/_base/basemodel.php on line 120

Call Stack: 0.0003 649720 1. {main}()

/--------/index.php:0 0.0147 3133968 2. CApplication->run()

/— …

  1. CCodeGenerator->prepare() /------/yii/framework/gii/CCodeGenerator.php:61 0.1186 7014464

  2. GiixModelCode->prepare() /-------/yii/framework/gii/CCodeGenerator.php:158 0.2050 7140784

  3. CCodeModel->render() /-----------/protected/extensions/giix-core/giixModel/GiixModelCode.php:90


I apologize for not being able to debug your code as I am currently working in three projects. But I will have a better look.

Thanks again for your efforts to help us.

My sentiments exactly!


I’ll tell you the story.

In 2010-10-16 I registered the giix extension in the Yii extension repository, but I had to stop the development for a while. Meanwhile, the extension received 9 downvotes because its page was empty.

The downvotes were against the blank page.

I am happy you liked giix. Thank you!

That figures!

Now I can sleep tonight. :lol:

In that case it’s no wonder.

But I’m happy it’s here.

About time we had some extended Gii-ness.

gii-template-collection has been around for a while. It is worth checking also.

Besides, giix is based on gii-template-collection.

Antonio Ramirez, would you mind opening a ticket in Google Code with more information?

Thank you.

Please forgive me as I am completely new to Yii. What are the differences in the Authentication types in the CRUD setup? When I used the Yii User management access control, for instance, I was unable to do anything with my controller (Logged in as the default admin/admin)

Just curious what each one of those options means.

I’m loving the additional features, though. I especially like that it handles my table relationships so effortlessly. Very nice!

I will buddy,

Again, thank you very much for your efforts. Is people like you that makes Yii the most amazing network i have been involved with.

Do not worry about the negative votes, its a great idea.

Out of curiosity, what exactly is the support for:

"More support for HAS_MANY and MANY_MANY relations."

If I have a widgets table and a widget_users table








How does giix help me create a has_many relationship (besides going into the controller and updating the file like I would with gii).

I love the changes/updates you’ve made to the default gii so far… keep it up! Maybe they’ll incorporate your giix changes into the default gii module on a future release.

Please check the source code as there is no documentation for them yet. You can look at the files in giix-core/giixCrud/templates/default/auth/

If you have trouble to understand the code, the Yii guide may help you:

I don’t think I deserve so much. There is a lot of people doing a lot more for Yii than I am able to :)

Qiang removed the downvotes, since they were given to the blank page.

giix generates a view (view.php, for action "view") where related items (HAS_MANY and MANY_MANY) are listed.

Also, appropriate controls are shown depending on the relation type.

Note that there’s no built-in functionality such as offered by CSaveRelationsBehavior.

Also, giix does not "create a relationship" as it does not change your schema. It just reads it.


I’m having the same problem as Antonio Ramirez.

Parse error: syntax error, unexpected $end in …\protected\extensions\giix-core\giixModel\templates\default\_base\basemodel.php on line 120


/* me wonders what’s on line 120 of basemodel.php … ::) */

Could you please check ?

Perfect, many thanks!

This is an awesome addon, it actually made me do the final switch from cakephp to yii. Keep up the good work! You are making my life/work much easier and more fun to program!

Respect from norway.

Best regards,


i have found a possible bug. i have three tables:

visitor bleongs to one order

one order has many visitors.

orders belong to transport

transport has many orders.

i scaffolded using giix.

When creating an entry, for example a visitor from the scaffolded "visitor/create". it creates lots of duplicates visitor. this is the same in all the different cases.

How can i find the error? is this a bug?