On Jul 2, 3:57 pm, "Paul R. Zwiers" <[EMAIL PROTECTED]> wrote:
> I have a relationship that works very well. But putting in a condition
> gives me a headache.
>
> I have the following:
>
> Users -HABTM- Groups -HABTM- Services
>
> So depending to which groups a user belongs he/she gets rewarded with some
> services.
>
> A Service->findAll() returns everything I want (all services of all
> users), but now I want to restrict the results of findAll() with only the
> services the user (which is logged in and the id is stored in the session)
> has a right to.
>
> I tried filling in the $conditions array with things like
> array( 'users_groups.user_id' => the_user_id_in_the_session ) and such but
> it keeps complaining about not having the said column, which is correct
> because it does a SELECT of the services table.
>
> I have a headache. Where do I start solving this. I could eventually dig
> into the complete array in the view and only show the said services but
> that does not seem to be the right MVC way...
>
> Can somebody give me a pointer?
>
> TIA
> Paul

Hi Paul,

you are not going to be able to solve your problem with a single query
(unless you write it manually) but you'll find some detailed
explanations/examples of what you can do here:

http://groups.google.com/group/cake-php/search?q=filtering+habtm&start=0&scoring=d

hth,

AD


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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