Code Generator Extreme

LOL, I just used this (working) one-line code for HAS_ONE relationship dropdowns in CRUD generator:

return "CHtml::activeDropDownList(\$model,'{$column->name}', CHtml::listData({$relation[1]}::model()->findAll(array('order'=>'title','condition'=>'id NOT IN('.implode(',',CHtml::listData(\$model::model()->findAll(array('select'=>'id')),'id','id')).')')), 'id', 'title'), array('prompt'=>'Select ...'));";


I think gii will end this

i think one of the best advantages of the gii framework will be that you can define

different templates and sub-templates about how your views will look like after

generation. Such working horror-lines still could be implemented in the CRUD Generator

code, but being separated in a more low-level area.

it’s very exciting to see what gii could be in the future. a ‘collection’ of

user-contributed templates and even code generation ‘behaviors’ could be made by

the community. For example, there could be a behavior attached to the code generation

that generates list boxes out of a relation (like in this example). if i attach

another behavior, it would generate a relation widget. in an third code generation behavior

it would generate nothing more but an input field, and so on.

After that, we need behaviors for MANY_MANY relations, that generate a listbox, checkboxlist,

a ajax twopane view, and so on.

Then we could provide a bunch of ‘footer’ templates, for example. All this can be mixed in my

‘code generation run’. I click ‘Go’ and (almost) everything is done :)

Making re-usable generation logic snippets should be the way to go.

What do you think about this?

Hi thyseus,

that sounds very great, in fact I’ve already included your extension in my app:

But, I haven’t been able to get it to work completely, yet.

Do you plan gii-related updates for this extension?

It looks exactly like the thing we need for CRUDs.

Best regards,