Hi, I use CakePHP 1.2.6 and have the following relations:
Showcase HABTM User belongsTo Galleryitem hasOne Image
I try to get all the data related to a Showcase, and therefor also all its users with their Galleryitem -> Image. I use the following query:
$showcase = $this->Showcase->find('first',
array('conditions'=>array('Showcase.id'=>$id),
'contain'=> array(
'User' => array(
'Galleryitem' => array(
'Image'
)
)
)
)
);
This does returns and empty array of Galleryitem
and thus no Image
records at all.
If I try the following:
$showcase = $this->Showcase->User->find('first',
array(
'contain'=> array(
'Galleryitem' => array(
'Image'
)
)
)
);
I do get some data here about Image
. So it seems the depth plays a role here.
Other factors that came to mind were the belongsTo
relation between User
and Galleryitem
.
What causes my query not to return data from a depth of 3?
Update
The set of Showcase relations is in my project much more branched than I explain above. All the other branches properply show up. So I guess it has to do with specific relations in this branch, the User belongsTo Galleryitem
.
Strange still, because the other branches contain this very same set of Galleryitem hasOne Image
relation.