You're doing something wrong - this is very standard stuff. Have you got the 
Containable behaviour attached to the Category model? Or app_model?

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 4 Nov 2011, at 17:41, Daniel wrote:

> On Nov 4, 5:20 pm, Jeremy Burns | Class Outfit
> <[email protected]> wrote:
>> Daniel - this is 101 CakePHP - no, PHP - stuff.
>> 
>> Your controller function will call a model function to do the find. Put the 
>> code inside that model function. Or - if you want to call this find directly 
>> from a controller (the revised version I just sent you) - put it in a 
>> controller function (view?).
>> 
> 
> I don't understand how to put the code into the model so I put the
> modified code in the controller (with one change, there is no
> Category.category_id it's just Category.id)
> 
>               $categories = $this->Category->find(
>                       'all',
>                       array(
>                               'conditions' => array('Category.id' => $id),
>                               'Contain' => array(
>                                       'Post' => array(
>                                               'User' => array(
>                                                       'User.id',
>                                                       'User.name'
>                                               )
>                                       )
>                               )
>                       )
>               );
> 
> I don't get any error but now my related posts have disappeared from
> the category view, so I can't use this solution as it stands.
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
> 
> 
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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