I am trying to set conditions on relationships in a model to better
filter records returned in finds. If I specify conditions on which
users are returned in a $this->Post->find('list) call I'm still
getting all the records returned instead of the conditions
(booleanfield = 1) placed in the model.

User hasMany Post
Post belongsTo User

In the Post model:

var $belongsTo = array(
'User' => array(
        'className' => 'User',
        'foreignKey' => 'user_id',
        'conditions' => array('User.booleanfield' => 1)
)
);

Obviously I could place that condition in the find call but isn't this
what is supposed to happen when you put conditions in the model? I've
also tried putting the condition in the User model under the hasMany
variable but that doesn't work either. What am I doing wrong?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to