I need your help because I can't extract results as I want from my query result without doing a foreach loop.
My query returns an array like this one :
array(
(int) 0 => array(
'Event' => array(
'id' => '1',
'title' => 'Event title',
),
'ShopstaffR' => array(
(int) 0 => array(
'id' => '1',
'event_id' => '1',
'shopstaff_id' => '1'
),
(int) 1 => array(
'id' => '2',
'event_id' => '1',
'shopstaff_id' => '2'
)
),
'Shopstaff' => array(
(int) 0 => array(
'id' => '1',
'name' => 'Ben',
'EventsShopstaff' => array(
'id' => '1',
'event_id' => '1',
'shopstaff_id' => '1'
)
),
(int) 1 => array(
'id' => '2',
'name' => 'Alex',
'EventsShopstaff' => array(
'id' => '2',
'event_id' => '1',
'shopstaff_id' => '2'
)
)
)
),
(int) 1 => array(
ETC ....
Event model has an HABTM relation with the Shopstaff model and I would like to extract an array as this one :
array(
(int) 0 => array(
'Event' => array(
'id' => '1',
'title' => 'Event title, Shopstaff: Ben, Alex',
),
),
(int) 1 => array(
ETC ....
The problem is that I can't manage to do that with set::combine
method because I don't know how many ShopStaff there will be.
Any idea ?