banned_user.php!
Enjoy,
John
On Mar 30, 4:28 pm, WhyNotSmile <sharongilmor...@googlemail.com>
wrote:
> I have 3 models in my app:
> Group
> Users
> Banned Users
>
> Each of the Users and Banned Users belong to a group (or used to, in
> the case of banned users), so they both have a field called group_id.
>
> When I paginate the Users, I get a list of users, including their
> group.
>
> When I do the same thing for Banned Users, I don't get their group
> information.
>
> Here's what I have in my models:
>
> class Group extends AppModel {
> var $name = 'Group';
> var $hasMany = array(
> 'User' => array(
> 'className' => 'User',
> 'foreignKey' => 'group_id',
> 'dependent'=> false
> ),
> 'BannedUser' => array(
> 'className' => 'BannedUser',
> 'foreignKey' => 'group_id',
> 'dependent'=> false
> )
> );
>
> }
>
> class User extends AppModel {
> var $name = 'User';
> var $belongsTo = 'Group';
>
> }
>
> class BannedUser extends AppModel
> var $name = 'BannedUser';
> var $belongsTo = 'Group';
>
> }
>
> In the controller (which includes both of the above in $uses), I have:
>
> $this->User->recursive = 1;
> $userlist = $this->paginate('User');
>
> $this->BannedUser->recursive = 1;
> $userlist = $this->paginate('BannedUser');
>
> The first one returns Group info, the second doesn't. Can anyone see
> what I'm doing wrong? Thanks!
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@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
No comments:
Post a Comment