Tuesday, February 1, 2011

Re: Containable Results

This is (regrettably) how it is supposed to work as it is using outer joins. To achieve what you want to do you need to use the 'joins' options, where you can specify inner joins, which will filter your results correctly. http://book.cakephp.org/view/1047/Joining-tables

Jeremy Burns
Class Outfit

jeremyburns@classoutfit.com
http://www.classoutfit.com

On 1 Feb 2011, at 11:18, Name256 wrote:

Hello,

I have been trying out the containable behaviour and it seems that the
applied filter on "contained" models only apply to them and not the
parent model.

For example I have a model Transaction and TransactionDetail where
Transaction hasMany TransactionDetail. If I apply a condition on the
TransactionDetail, the result still returns all the transactions. I
did an override of the afterFind method to further filter the data but
it ended up breaking pagination in the view.

I have had a look at the many posts where containable has been
discussed but I'm at a loss as to whether there is another way of
retrieving paginated data with all conditions applying for all models
present.

Kindly assist.

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

No comments: