yiic command: modelall + crudall

Hello All,

I extended the yii-CLI with a new commands to generate model and crud for all Tables in Database automaticly.

Just place the file in following yii-framework-path: yii\framework\cli\commands\shell

The generated classes are not fully tested. So use it with no warrenty

Greetings from Germany


It looks nice!

I would suggest that the customized shell commands are put under protected/commends/shell instead of the framework directory.

Also, the modelAll command is only for MySQL.

Hello everybody,

This is my first post (and is in a very old theard :) )

I start to test it and the commands are not seen in the framework location. Instead are seen in the application. I added the YIIPATH at the require_once.

I can generate the models but not the CRUD because the indexes in my tables. After I'll fix the tables I'll check again if everything is working.



Looks like it's working but the question is:

Why "crudall" cmd generates only 'create','update','list','show'? "crud" cmd has as an extra 'admin','_form'. I add them and works like a charm.

Thanks a lot, it help me a lot.

Hi imasia,

good to hear that it helped you a bit.

You answered your question already by yourself: very old thread :slight_smile:

When this commands are written, there were no "admin and "_form" views in the framework…

Maybe you want to share your changed version here…

Greetings from Germany.



I really didn't changed much. I just couldn't put the command in the framework (I liked to) and I put them in the site (protected\commands\shell).

I modified line 12:


Same for modelall, but the file name.

Only in crudall I've changed line 84 by adding 'admin' and '_form' in the array.

Attached you wil find only crudall because in the end I used for model generation mwbmodel and not a big change in modelall.

Good luck,


;) Greetings from Romania

Anybody knows what happens to the attachment on this thread? They seem to be missing.

really missing…

Unfortunately they seem to got lost with the forum update:



here is my current version, hope it works for you, because it was long not used…

Greetings from Germany