Thanks for your reply,

I have had a look at this and tried out a few options on how best to
implement pagination functionality using options and I came up with
something that works 99%. Because of the join that I am doing, It
means that in the event that I have a Transaction with more than one
TransactionDetail returned, an extra Transaction record is created.
Below is a snippet of the code;

$options['joins'] = array(
                array(
                        'table' => 'transaction_detail',
                        'alias' => 'TransactionDetail',
                        'type' => 'LEFT',
                        'conditions' => array(
                                'Transaction.id =
TransactionDetail.transaction_id'
                        )
                )
        );
        $options['conditions']=array(
                'Transaction.matched'=>true,
                'TransactionDetail.shop_id'=>$this->getUserShops()
        );

$this->paginate = array(
                'conditions'=>$options['conditions'],
                'joins'=>$options['joins'],
                'order'=>'Transaction.unix_time_stamp DESC',
         //Commented
'group'=>'TransactionDetail.transaction_id',
);

This code works as I have described above but with the group option
uncommented (returns the correct number of Transaction records),
pagination breaks once again and the pagination links are disabled. I
was wondering whether there is a way around this, maybe a custom way
of doing pagination where I can set variables such as number of
records because as much as there is a count query run to find the
number of records, this is not being passed to the pagination
function.

Kind regards.

On Feb 1, 2:57 pm, Jeremy Burns | Class Outfit
<[email protected]> wrote:
> 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
>
> [email protected]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 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > [email protected] For more options, visit this group 
> > athttp://groups.google.com/group/cake-php

-- 
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

Reply via email to