Why not use contain?
'contain' => array(
'Property' => array(
'conditions' => array(
'Property.id' => $foo),
'fields' => array(
'Property.field1,
'Property.field2')),
'Country' => array(
'fields' => array(
'Country.name'))));
Something along those lines.
_____
From: Bryan Paddock [mailto:[email protected]]
Sent: September-09-09 12:42 PM
To: [email protected]
Subject: Re: Finding deeply related models
Oh no ways....
Hmm..
$this->Property->recursive = 1;
pr($this->Property->find('all'));
and it prints out the properties without extended associated data...
$this->Property->recursive = 2;
pr($this->Property->find('all'));
and it returns nothing at all...
hmmm let me look through my models - maybe I have some code in the callbacks
which is causing problems...
On Wed, Sep 9, 2009 at 5:07 PM, grigri <[email protected]> wrote:
Where on earth did you get that idea?
See: http://book.cakephp.org/view/439/recursive
Check the model tests in the source, there are many examples of
setting recursive to 2, 3, and even 6 (in the testReadFakeThread
method).
hth
grigri
On Sep 9, 4:01 pm, Bryan Paddock <[email protected]> wrote:
> recursive only accepts 3 values... -1 / 0 / 1
> Tried that :(
>
> On Wed, Sep 9, 2009 at 4:57 PM, grigri <[email protected]>
wrote:
>
> > Set recursive to 2?
>
> > On Sep 9, 3:21 pm, Bryan Paddock <[email protected]> wrote:
> > > Hey all,
> > > How can I get cake to retrieve deeply related info?
>
> > > *Property *belongsTo *Location *which in turn belongsTo *Country*
>
> > > How can I get $this->Property->find(xx) to return the Country as well?
>
> > > I'm having the same problem with *Property *belongsTo *Seller *which
> > > belongsTo *User *(every time I retrieve data for property I have to
fetch
> > > the User row manually)
>
> > > Its happening in all of my finds - It only goes one level deep...
>
> > > Any ideas? I've tried setting recursive to 1...
>
> > > Bryan
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---