Extend Gii - Url Paths

So I wanted to create my own code generator in Gii.

  1. I’ve copied the “gii” folder from the framework in my project’s “modules” folder, and went to see what’s going on in the code.

  2. cp gii.generators.model gii.generators.mything (then changed everywhere "model" to "mything")

so far so good

Now I can’t find what’s exactly going on when I press the preview button.

In my browsers navigation bar I have “example.com/index.php?r=gii/model” or “example.com/index.php?r=gii/mything” but I can’t find a controller/action called “model” or “mything”.

How is this working ?


First you can downlaoded gii folder in put the extension folder not in module folder.

second you can install the gii extesion on protected/confing/main.php file… on modules array






			'generatorPaths' => array(

				'ext.giix-core', // giix generators




		'rights'=>array( 'install'=>true, // Enables the installer. 






and check the url


i hope it’s some help.

Maggie Q(Ankit Modi) :

I don’t have trouble installing it, I’ve installed it and it works just fine.

My problem is with the routing system/urls/the links (or I don’t even know how to call them), lets look at an example.

  1. you go to gii (path says …index.php?r=gii/default/login)

  2. enter the password

  3. click on generate model (path says …index.php?r=gii/model)

on step (1-2) I can see that there is an “actionLogin” in the “DefaultController” witch is nice :)

but what is going on at the 3-rd step ? there is no class or action with the name "model" ?

Hi if I undesteand first you can create the model and second you want to create the controller and view file and set the action URl urlManager on main.php file.

That is not what I mean. I can create everything. But I want to create my own “Generator” and can’t figure out what is called when you go to the path “index.php?r=gii/myGenerator” because this paths are created somehow dinamically.

see the below image


Screenshot from 2013-09-26 13:14:44.png

first i want to crate the model

and then after u want create the controller and view file using CRUD gernator button

see image


Screenshot from 2013-09-26 13:15:36.png

and in your brower address filed you can type this


i hope it’s some help.

That’s not what I mean.

In your first image there is a menu on the left "Generators". I have added another element to that menu (copied the default "model" generator and I want to change something in it.

Now when i press the "Preview" button the form gets submitted but I can not find the code that is executed when the "Preview" button is pressed.

You can open the "gii" or "giix" and see for yourself, the routes are handled different.

If I understand you want to create the model but you can not find code in your project?

No, that’s not it :)



I’ve added a new generator called “Table generator” by copying the default “model” generator from system.gii.generators.model to system.gii.generator.table and also changed everywhere “model” to “table” (it’s the last one in the left menu)

Here’s the problem:

I can not find the code that get’s executed when the “Preview” button is pressed. I see that there is some validation going on, and after that a model is created, but I can’t find the code that does all that stuff

sorry man i can’t help. :unsure:

I’ve done some nasty things back then while trying to extend “Gii”. And after a while I’ve come across this extension:


An example on how to extend gii can be found there.