If I do this:
$cdata = $this->Party->find('first',
array('contain' => array(
'Person' => array(
'Employee' => array(
'Volunteer'),
'Title'))));
Debugger::dump($cdata, 10);
I get this:
array(
'Party' => array(
'id' => '9',
'save_bit' => true
),
'Person' => array(
'id' => '5',
'title_id' => '1',
'first_name' => 'bob',
'middle_name' => '',
'last_name' => 'brown',
'is_active' => false,
'date_of_birth' => '1999-07-07',
'gender' => 'M',
'party_id' => '9',
'Title' => array(
'id' => '1',
'title' => 'Ms',
'description' => ''
),
'Employee' => array(
'id' => '5',
'person_id' => '5',
'Volunteer' => array(
'id' => '5',
'employee_id' => '5'
)
)
)
)
But I really want to get this:
array(
'Party' => array(
'id' => '9',
'save_bit' => true,
'Person' => array(
'id' => '5',
'title_id' => '1',
'first_name' => 'bob',
'middle_name' => '',
'last_name' => 'brown',
'is_active' => false,
'date_of_birth' => '1999-07-07',
'gender' => 'M',
'party_id' => '9',
'Title' => array(
'id' => '1',
'title' => 'Ms',
'description' => ''
),
'Employee' => array(
'id' => '5',
'person_id' => '5',
'Volunteer' => array(
'id' => '5',
'employee_id' => '5'
)
)
)
)
)
This way the array is following the natural hierarchy of my database tables and also works with my website forms for saving and editing which I have declared like so:
echo $this->Form->input('Party.Person.first_name');
echo $this->Form->input('Party.Person.is_active');
Is it possible to do this with Containable, if so how? Thanks!