I have an User class and a PermissionGroup class. User has defined a
hasAndBelongsToMany relation with PermissionGroup.
If into database exists one user with two permission grups assigned,
when I run this code:
$userA = $this->User->findAll($sort, $limit, $page); //gets all the
User records and sorts them.
It returns an array that contains the user data array and the
permission groups array:
Array(
[User] => Array(
here the user data
)
[PermissionGroup] => Array(
[0] => Array(
here the FIRST permission data
)
[1] => Array(
here the SECOND permission data
)
)
)
I turn it into a json format because I use ExtJS library into the
views:
{"total":1, "users":[{"User":{ here the user data }, "PermissionGroup":
[{ here the first permission data }, { here the second permission
data }]}]}
But I need an array for each permission group assigned to user. Like
this:
Array(
[User] => Array(
here the user data
)
[PermissionGroup] => Array(
[0] => Array(
here the FIRST permission data
)
)
),
Array(
[User] => Array(
here the user data
)
[PermissionGroup] => Array(
[0] => Array(
here the SECOND permission data
)
)
)
Turned into json format:
{"total":2,
"users":[{"User":{ here the user data }, "PermissionGroup":{ here the
FIRST permission data }},
{"User":{ here the user data }, "PermissionGroup":{ here the SECOND
permission data }}
]}
¿How can I do it?
Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---