Users HABTM Profiles:
I have 2 users:
userone: id = 3
usertwo: id = 4
and 2 profiles:
public: id = 3
private: id = 4
userone belongs to public profile
usertwo belongs to private profile
I'm using Containable behavior. I want the User details if the user
belongs to a 'Public' Profile. Here's what I have
$users = $this->User->find('all', array(
'fields' => array('User.name'),
'contain' => array(
'Profile' => array(
'conditions' =>
array('Profile.name' => 'Public')
)),
'recursive' => 2
));
However, its giving me this in debug:
Array
(
[0] => Array
(
[User] => Array
(
[name] => userone
[id] => 3
)
[Profile] => Array
(
[0] => Array
(
[id] => 3
[name] => Public
[UsersProfile] => Array
(
[id] => 3
[pro_id] => 3
[user_id] => 3
)
)
)
)
[1] => Array
(
[User] => Array
(
[name] => usertwo
[id] => 4
)
[Profile] => Array
(
)
)
)
I expect only userone to be displayed and not usertwo. Am I doing
anything wrong?
thanks!
KS
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 [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