Sunday, December 28, 2008

Conditional find on recursive belongsTo association

For this issue there are 3 models in use

Staff
Person
Organisation

Related as follows

Staff belongsTo Person
Person belongsTo Organisation

I need to list Staff that match a condition in the Organisation model
and am trying to do so with the following

$this->paginate('Staff', array('Organisation.scheme_id'=>
$scheme_id));

or

$this->Staff->find('all', array(
'conditions'=>array('Organisation.scheme_id'=>$scheme_id),
'recursive'=>1
));

However no matter what I set the recursive value to Staff does not
associate itself with the Organisation model. Am I wrong in thinking
I can link my models in this manner (i.e. using a 2nd level belongsTo
association)?
--~--~---------~--~----~------------~-------~--~----~
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: