CRUD command

this beautiful command create al the neccessary for scaffolding.

the views created contains obviously standard html code. I want to use other html code for my scaffolds. is it possibile to create sort on "mycrud" commad?

how to approach?


I'm working on a way to let you create your own shell command. Will let you know.

Ok, you are now able to create your own shell commands. Just drop your command class files under protected/commands/shell. Run the local version of yiic shell, you will see your shell commands appear.

You can create your own shell commands (such as crud) by extending existing shell commands (e.g. CrudCommand), and specify your own templatePath.

that's good tried and works well.

I have extended CrudCommand but what i don't want to do is duplicate your controller.php class that is in /views/shell/crud. now if I set templatePath, I have to put in that path all the necessary files (controller.php, create.php, list.php, etc…).

Don't you think is a good idea that you check for every file (run in CrudCommand.php) and use the custom one when found and standard when not?


great, but i saw that the check is done only for views files. it should be done for controller too.

another thing: if I set protectedAttributes() in activerecord class, this fields are created in insert and update views. don't you think it is not right?

If we do not create fields for protectedAttributes, the created CRUD may not work as some required fields are not set. In this case, you will need to manually change the code anyway. So we choose to create all fields so that CRUD can work in all cases. As a developer, you should change the created CRUD code to remove those protected fields.

what about the file check for the controller class?

ah, forgot. fixed.