Sorry to come back to this so late but thought I'd make a note on your
solution.

There should be no need to call $modelB = ClassRegistry::init('B'); as
modelA should be related to modelB allowing you to use

$this->modelA->modelB->unbindModel(array('belongsTo' => array('C)));
$this->modelA->bindModel(array('belongsTo' => array('C' => array(
   'className' => 'C',
   'foreignKey' => false,
   'conditions' => 'B.c_id = C.id',
))));
$conditions = array('C.somefield' => 'somevalue');
$this->modelA->find('all', array('conditions' => $conditions));

The above is what you would use from the controller (generally where
you would be calling finds for views) but it looks from maxmils code
that he is working within his model (which makes sense if he's
creating a function in his model which will be used from multiple
controllers/actions).  In which case the code would be

$this->modelB->unbindModel(array('belongsTo' => array('C)));
$this->bindModel(array('belongsTo' => array('C' => array(
   'className' => 'C',
   'foreignKey' => false,
   'conditions' => 'B.c_id = C.id',
))));
$conditions = array('C.somefield' => 'somevalue');
$this->find('all', array('conditions' => $conditions));

HTH, Paul.
--~--~---------~--~----~------------~-------~--~----~
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