First question: maybe with Containable behaviour?
$this->Term->contain('Course' => array(
'conditions'=>array( 'Course.id' => 1),
'order' => 'year DESC',)
);
Damn, You can even be dirty $this->Term->hasMany['Course']
['conditions'] =" Course.id =1;" :)
On Jul 1, 6:49 am, Grant Cox <[EMAIL PROTECTED]> wrote:
> The documentation you are referring to is misleading - a join is only
> used across a belongsTo association (and hasOne), never for hasMany.
>
> Basically, you can't have query conditions across a hasMany
> association. You will have to either query the other way (as you saw,
> the Course belongsTo Term, so you can put Term conditions in the
> Course query), or do the filtering in PHP after retrieving all data.
> The Containable behaviour will not help with this - it really just
> does some tricky bind / unbind and sets the appropriate recursive for
> the query, it won't help with conditions.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---