Model related as condition of paginate

2008-02-21 Thread dandreta

Hi!
I have two models:(Client,purchase)
One client has many purchases.

In clients_controller:

If I want to paginate all clients with name John I do:
$this-paginate(array('Client.name' = 'John'))

But how can I paginate all clients who have bought a certain product
(for example, condition: purchase.name='car')?

Thanks and regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Model related as condition of paginate

2008-02-21 Thread Chris Hartjes

On Thu, Feb 21, 2008 at 9:54 AM, dandreta [EMAIL PROTECTED] wrote:

  Hi!
  I have two models:(Client,purchase)
  One client has many purchases.

  In clients_controller:

  If I want to paginate all clients with name John I do:
  $this-paginate(array('Client.name' = 'John'))

  But how can I paginate all clients who have bought a certain product
  (for example, condition: purchase.name='car')?


You need create paginate() and paginateCount() methods in your model
to override the default ones..  I talked about this on the mailing
list earlier this week, so search the google group.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: Moving from herding elephants to handling snakes...
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---