If I remember right a core member once wrote that this is a known limitation of the current "conditions array" for relations. Personally, I think this should be addressed in 2.1 as a bugfix to be fixed (if I add a global condition it should always be applied, no matter what).
As of right now you probably need to manually join the conditions. On 29 Nov., 18:16, Jeremy Burns <[email protected]> wrote: > I've noticed that if I have conditions on model associations, for > example: > > $hasMany = array( > 'ActiveUser' => array( > 'className' => 'User', > 'foreignKey' => 'group_id', > 'conditions' => array( > 'ActiveUser.active' => 1 > ) > ) > ); > > ...and bring that key into a find BUT with an added condition, for > example; > > $groups = $this->find( > 'all', > array( > 'contain' => array( > 'ActiveUser' => array( > 'conditions' => array( > 'ActiveUser.id' => 10 > ) > ) > ) > ) > ); > > ...the condition on the join is ignored. So in this example the user > with an id of 10 will come back whether he is active or not. > > How do I overcome that? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
