Hi,

This is haw I paginate and it works OK,
I have 3 join tables ( I can set different type of joins ),
Did you understand what is happening ?

<PHP CODE>
function MyFunctionThatReturnPaginateArrayInfo {
....................
code code code
...................
return array(
  'MortgageDetail' => array(
                'limit'=> 10,
                'fields' => array(
                                'id',
                                'mortgage_provider_id',
                                'name',
                                'mortgage_category_id',
                                .
                                .
                                '( (' . $initial_monthly_payment_formula . ' )/ 
' .
(float)$m_borrow/1000 . ' )  as cpt',
                                .
                                .
                                'name',
                                'specialoffer',
                                'summary',
                                'directlink',
                                'ads_link',
                                'MortgageProvider.name'
                                // 'UNIX_TIMESTAMP(createddate) as created,
UNIX_TIMESTAMP(updatedate) as updated'
                                ),
                                'recursive' => -1,
                                'joins' => array(
                                   array(
                                        'table' => 'mortgage_categories',
                                        'alias' => 'MortgageCategory',
                                        'type' => 'LEFT',
                                        'conditions' => 
array('MortgageDetail.mortgage_category_id =
MortgageCategory.id')
                                   ),
                                   array(
                                        'table' => 'mortgage_providers',
                                        'alias' => 'MortgageProvider',
                                        'type' => 'LEFT',
                                        'conditions' => 
array('MortgageDetail.mortgage_provider_id =
MortgageProvider.id')
                                        ),
                                array(
                                        'table' => 
'mortgage_providers_general_limits',
                                        'alias' => 
'MortgageProvidersGeneralLimit',
                                        'type' => 'INNER',
                                        'conditions' =>
array('MortgageProvidersGeneralLimit.mortgage_provider_id =
MortgageProvider.id')                                                   ),
                                                ),
                                                'conditions' => 
array("{$sWhereCond}"),
                                                'order' => array('initialrate')
                                        )

</PHP CODE

On Fri, Aug 28, 2009 at 1:58 AM, Dean C<dean.clatwor...@gmail.com> wrote:
>
> Hi folks,
>
> Before I begin, yes I've read this page:
> http://book.cakephp.org/view/249/Custom-Query-Pagination
>
> I've also read many of the other pages on Google but I'm still stuck!
>
> First of all if I may introduce you to my query:
> http://bin.cakephp.org/view/1064020598
>
> It's a union query that allows me to search across two tables and
> return the results, ordered by relevance. To put it simply I want to
> paginate these results, but I haven't a clue how to do it. I tried,
> and failed, over-riding the paginate and paginateCount methods in my
> model, but I shan't even begin to post my long list of errors.
>
> Where should I start?
>
> Thanks!
>
> Dean
>
> >
>



-- 
Paul-Cosmin Constandachi
Tel: 0723.46.46.42

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