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?
thanks
Page 1 of 1
CRUD command
#2
Posted 10 October 2008 - 10:15 AM
I'm working on a way to let you create your own shell command. Will let you know.
#3
Posted 10 October 2008 - 11:57 AM
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.
You can create your own shell commands (such as crud) by extending existing shell commands (e.g. CrudCommand), and specify your own templatePath.
#4
Posted 14 October 2008 - 08:23 AM
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?
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?
#6
Posted 14 October 2008 - 09:43 AM
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?
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?
#7
Posted 14 October 2008 - 10:32 AM
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.
Share this topic:
Page 1 of 1