Hi Tomas

> Err... correct version.
> 
>     function index () {
>       $this->data['Commitment']['actionplan_id'] = 300;
>       $this->data['Commitment']['action_area'] = 1;
>       $this->data['Commitment']['order'] = 0;
>       $this->Commitment->save($this->data);
>     }


This is what I have been doing previously.  However in this application 
it has resulted in lots of these set-up routines to create the complete 
object, which is making the controller large and cumbersome.

What I have ended up doing is to create a method newData() in the 
Commitment model that sets up the data (as you do above) in an array and 
returns it.  I call that from the Feedback controller and hey presto I 
have a new data set ready to use.

This seems like the best place to put that code to create a data set. 
Now if I modify the Commitment model I have all of its relevant code in 
one place, rather than having to hunt for it in various controllers.

Thanks for your input :-)

Regards,
Langdon

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to