Hi All,

I have a similar problem and am hoping that by posting on this post we
can get a resolution and some good advice from the community for both
our problems

Here goes:

I have the following models (denoted by UPPERCASE) :

USERS belongsTo CLIENT,
CONTACTS belongsTo USERS and HABTM CONTACT_GROUPS.


I have a setting on the clients side that allows users to each others
clients, i.e. a company may have many contacts these could belong to
different users, however ultimately they belong to the company. Hence
at times a user should be able to see all the contacts for a company.

Now paginating all contacts is simple using Cakes pagination and even
paginating contacts that only belong to a specific user.

Where I need advise or help is paginating the contacts that belong to
a specific group and user. i.e. at times I will want to display all
contacts linked to a specific group and user and at other times I need
to limit this by displaying contacts that are linked to a specific
group and CLIENT (being the top level)


I have tried to use containable in the paginate method to no avail
what I need to know if there is a simple solution in passing two
related models fields into the conditions array of the paginate
function or if I have to override the paginate function in the model.

Again to simplify:

PAGINATE: GET CONTACTS WITH user_id IN (1,2,3) AND group_id = 1

or

PAGINATE: GET CONTACTS WITH user_id = 1 AND group_id IN (1,2,3)


Any advise or help will be appreciated.

Thanks
Jacques












I can easily paginate the contacts


On Aug 12, 7:37 pm, sunertl <[email protected]> wrote:
> On 12 Aug., 19:00, brian <[email protected]> wrote:
>
> > Why not just use find()? Can a User belong to so many Groups that you
> > need to paginate them?
>
> Normally, a user will belong to about 10 groups, but the "moderators"
> belong to much more (30-50). Also groups are used only for one year
> tops and I would like to keep an archive with all expired ones. So I
> think a pagination would be useful.
>
> And even if it wasn't for this case I still would like to know what's
> wrong here ;-).
>
> Btw: I just found a typo in my original post. The table for Group is
> "groups" of course, not "group" as stated above.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to