Hi everybody,
I new in cake, could you help me to format a data array?
I have this $data
array {
[0]=> array {
["Timetable"]=> array {
["slot_id"]=> "2" }
["Subject"]=> array {
["name"]=> "CAD" }
["Typeclass"]=> array {
["name"]=> "T1" }
["Room"]=> array {
["name"]=> "B1" }
["User"]=> array {
["username"]=> "Mary" }
}
[1]=> array{
["Timetable"]=> array {
["slot_id"]=> "3" }
["Subject"]=> array{
["name"]=> "CAD" }
["Typeclass"]=> array{
["name"]=> "T1" }
["Room"]=> array {
["name"]=> "B1" }
["User"]=> array {
["username"]=> "John" }
}
and so on...
When I used
$res_data = Set::combine($res_data, array('(%s) %s', '{n}.Room.name',
'{n}.User.username'), array('%s %s',
'{n}.Subject.name','{n}.Typeclass.name'), '{n}.Timetable.slot_id');
I reached this:
array {
[2]=> array {
["CAD T1"]=> "(B1) Mary" }
[3]=> array {
["CAD T1"]=> "(B1) John" }
[4]=> array {
["ISK T1"]=> "(B1) Mary"
["ISK T1"]=> "(B1) Bill"
["SGD PL1"]=> "(G5.1) John"
}
and so on...
But I need this:
array {
[2]=> array {
["CAD T1 (B1)"]=> array { [0]=> "Mary" }
[3]=> array {
["CAD T1 (B1)"]=> array { [0]=> "John" }
[4]=> array {
["ISK T1 (B1)"]=> array { [0]=> "Mary" }
["ISK T1 (B1)"]=> array { [1]=> "Bill" }
["SGD PL1 (G5.1)"]=> array { [2]=> "John" }
}
Thanks
Alexandre Correia
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---