Thanks for this; I think it could be useful to me. I forget that
there's a contain() method and this looks like a very good use of it.

On Mon, Jul 20, 2009 at 12:16 PM, MikeBates<[email protected]> wrote:
>
>
> I figured this out, in case anyone else is wondering how to do this, the
> children call has some extra options:
> function children(&$Model, $id = null, $direct = false, $fields = null,
> $order = null, $limit = null, $page = 1, $recursive = null)
>
> so I changed my code to this:
> $Category->contain( 'Product' );
> $Categories = $Category->children( $nodeId, false, null, null, null, 1, 1 );
>
> and it worked fine
>
>
> MikeBates wrote:
>>
>> I have created 2 models Category and Product
>>
>> Category hasMany Product
>> Product belongsTo Category
>>
>> Category uses the tree and the containable behaviours  , Product uses the
>> containable behaviour
>>
>> Is there a way, without using a separate call on the model for each node,
>> to get all the Categories with their pseudo-children Products.
>>
>> e.g.
>> Doing something like this in the controller
>> $Category->contain( 'Product' );
>> $Categories = $Category->children( $nodeId );
>>
>> This doesn't work btw, it just gives me the children from Category.
>>
>> Is there a way to use the association into the Product table? Or will I
>> have to just write my own SQL?
>>
>> Thanks,
>> Mike
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Tree-Behaviour-and-hasMany-associations-tp24543237p24543311.html
> Sent from the CakePHP mailing list archive at Nabble.com.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to