cake-php@googlegroups.com
[Top] [All Lists]

Re: Another HABTM question

Subject: Re: Another HABTM question
From: Jeremy Burns | Class Outfit
Date: Fri, 15 Oct 2010 18:35:05 +0100
The join table has to be in alphabetical order, so try permissions_users.

Jeremy Burns
Class Outfit

jeremyburns@xxxxxxxxxxxxxxx
http://www.classoutfit.com

On 15 Oct 2010, at 07:39, brybot wrote:

> I've searched and looked through this group and the online
> documentation for hours, but I'm having some difficulty with a simple
> problem.
> 
> Its a simple setup:
> 
> User HABTM Permissions
> 
> Everything is setup properly (3 tables: users, users_permissions,
> permissions).  And everything works fine, I'm just trying to make a
> simple select.
> 
> I want a list of the permission for a certain user.
> 
> I can get a list of all permission: $this->Permission->find('list',
> array('fields'=>'id'))
> 
> but i cannot seem to find the proper syntax to limit it to one user.
> Everytime I try to limit the results by the user as the HABTM cake
> documentation says:
> 
> $this->Permission->User->findById('4',
> array('fields'=>'Permission.*')) or
> $this->Permission->User->find('all',
> array('conditions'=>array('User.id'=>'4'),
> 'fields'=>array('Permission.*')))
> 
> The generated query drops the inner join to the permission table, and
> only selects the user.
> 
> Or I can get a list of the User and all its Permissions in a rather
> large array, but I cannot get a list.
> 
> Can anyone help?
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@xxxxxxxxxxxxxxxx
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
cake-php+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

<Prev in Thread] Current Thread [Next in Thread>