Yii Framework Forum: CRUD command - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

CRUD command Rate Topic: -----

#1 User is offline   ilzale 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 113
  • Joined: 08-October 08

Posted 10 October 2008 - 09:15 AM

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
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,880
  • Joined: 04-October 08
  • Location:DC, USA

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.
0

#3 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,880
  • Joined: 04-October 08
  • Location:DC, USA

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.
0

#4 User is offline   ilzale 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 113
  • Joined: 08-October 08

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?
0

#5 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,880
  • Joined: 04-October 08
  • Location:DC, USA

Posted 14 October 2008 - 09:18 AM

Done.
0

#6 User is offline   ilzale 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 113
  • Joined: 08-October 08

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?


0

#7 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,880
  • Joined: 04-October 08
  • Location:DC, USA

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.
0

#8 User is offline   ilzale 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 113
  • Joined: 08-October 08

Posted 14 October 2008 - 05:03 PM

what about the file check for the controller class?
0

#9 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,880
  • Joined: 04-October 08
  • Location:DC, USA

Posted 14 October 2008 - 07:50 PM

ah, forgot. fixed.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users