Friday, April 2, 2010

Re: Can I filter on models deep in a 'contains' ?

As Richard states, you need to use bindModel to force a join from
Auction to User. I assume Auction belongsTo Bid as LatestBid and
therefore the first query containable runs will include a join to
LatestBid.

Therefore you need to run the following before your paginate call

$this->Auction->bindModel(array(
'belongsTo'=>array(
'User'=>array(
'foreignKey'=>false,
'conditions'=>array('LatestBid.user_id = User.id')
)
)
), false);

If paginating your results you must include the false declaration as
the second parameter of bindModel() to the temporary bind is
persistent for both the finds paginate runs.

HTH

Paul

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

To unsubscribe, reply using "remove me" as the subject.

No comments: