Friday, October 30, 2009

Containable behaviour doesn't return all data

Hi
I use containable behaviour, but I don't get all data that I have
requested
My code is :

$options['fields'] = array('User.*');
$options['conditions'] = array('User.username' => $user_id);
$options['contain'] = array(
'Organization' => array(
'fields'=>array('Team.*'),
'User' => array(
'fields' => array('User.*')
)
)
);
pr($this->User->find('first',$options));

But I get only :

Array
(
[User] => Array
(
[id] => 1
.......
.......
)

[Team] => Array
(
[0] => Array
(
[id] => 4
.......
.......
[UsersTeams] => Array
(
[id] => 1
[user_id] => 1
[team_id] => 4
)
)
)
)

I don't get all users that are inside team

Between User and Team there is a hasAndBelongsToMany relation.

How can I do to get also all users that are in team?

Many Thanks
Marco
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

No comments: