Hi all,
Cutting to the chase:
1.) I'm writing code in a controller now.
2.) I need "raw" data (text from a cookie/s) managed by a custom
component (that could use the built-in Cookie component).
3.) The cookie's value will be used to retrieve associated data from a
particular model.
4.) The resulting record's primary key (id) will be set into $this-
>data as an association (e.g., $this->data['User']['foreign_id'] =
$resultRecord['SampleModel']['id'])
5.) Save $this->data into the final model.
I'm thinking of doing an App::import('Model') inside my custom
component, OR doing an App::import('Component') in my lookup model,
since "fat models and skinny controllers" is an often preached
discipline. These approaches feel dirty because accessing a model
inside a component, and accessing components inside models are not
generally recommended methods of writing manageable code.
I'm also thinking of writing the coupling code inside the controller,
although it would make the controller a little fatter ("keep it short,
stupid" is another discipline I'm striving to practice diligently).
Loose-coupling in the long run will make it easier to maintain and add
new features, but I'm not sure if writing the bulk of the code in the
controller is worth it.
Can you guys suggest how you approach this dilemma, or at least point
me where to look for techniques?
Cheers,
OJ
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" 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?hl=en