Wednesday, June 23, 2010

Re: Recursive find but not in all models

http://book.cakephp.org/view/1323/Containable

Jeremy Burns
Class Outfit

jeremyburns@classoutfit.com
http://www.classoutfit.com

On 23 Jun 2010, at 05:12, cdvrooman wrote:

> Fernando,
>
> you should use $this->User->unbindModel(array(
> 'belongsTo' => array('Company'),
> 'hasMany' => array('Table1', 'Table2', 'Table3'),
> 'hasAndBelongsToMany => array('Table4', 'Table5')
> ));
>
> before performing your query. Try unbinding all of the unwanted
> models associated with the User directory first. To make the unbinding
> permanent for the duration of the execution within the controller you
> can end the ->unbindModel call with:
> $this->User->unbindModel(array(
> ..................
> ), false);
>
> Good luck.
>
> On Jun 22, 9:52 pm, "Fernando Z. Bob" <fzmas...@gmail.com> wrote:
>> Hi.
>> I have a lot of relations between Users and another models.
>>
>> Like:
>>
>> User hasMany Download
>> User belongsTo Company
>> Company hasMany Product
>> Download hasMany Type
>>
>> So I wanna use the find method, like $this->User->find('first',
>> array('conditions'=>bla bla bla));
>>
>> But, it returns me ALL the data contained in Company, Product, etc...
>> I don't want this. I just want the recursive find enters the Download table.
>>
>> Do someone have the idea of how can I do that?
>>
>> Thank you.
>
> 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 cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: