Whats your Cake version? Recently I had kinda similar problem with Cake 2.2.
I've encountered a weird behavior with nested array and saveAll
function. Seems like it transforms your array to this before saving:
'Feeding' => array(
'Feeding' => array(
(int) 0 => array(
'location_id' => '42',
'amount' => '11',
'created' => '2011-08-21 04:19:24'
)),
'Feeding' => array (
(int) 1 => array(
'location_id' => '38',
'amount' => '11',
'created' => '2011-08-21 04:17:09'
)),
...
It adds another nested array for each data item. I think it's a bug.
--
Sergei
On Tuesday, July 10, 2012 9:57:15 PM UTC+9, Michael wrote:
>
> When I pass this array to my saveAll function, the events get saved but the
> feeding and the character do not. Is there an issue with multiple levels of
> indexed arrays? Would I be better off trying to save them individually?
>
>
>
> array(
> (int) 0 => array(
> 'Event' => array(
> 'event_type_id' => (int) 1,
> 'chronicle_id' => '1',
> 'start_date' => '2011-08-21',
> 'end_date' => '2011-08-21',
> 'confirmed_id' => (int) 1,
> 'location_id' => '4',
> 'created' => '2011-08-21 04:19:24'
> ),
> 'Feeding' => array(
> (int) 0 => array(
> 'location_id' => '42',
> 'amount' => '11',
> 'created' => '2011-08-21 04:19:24'
> ),
> (int) 1 => array(
> 'location_id' => '38',
> 'amount' => '11',
> 'created' => '2011-08-21 04:17:09'
> ),
> (int) 2 => array(
> 'location_id' => '46',
> 'amount' => '11',
> 'created' => '2011-08-21 04:18:03'
> )
> ),
> 'Character' => array(
> (int) 0 => array(
> 'character_id' => '35',
> 'role_id' => (int) 5
> )
> )
> ),
>
> )
>
>
> Thanks.
>
>
>
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php