I've run into an interesting problem today. Here's the scenario.
I have 3 Models:
Station (model)
id
station_id
Store (model)
id
station_id
phase_id
Phase (model)
id
phase
And the relationships are:
Store belongsTo Station -- Store belongsTo Phase
Station hasOne Store
Phase hasMnay Store
Now whats happening is, from the Stations_Controller, I want to do a
Find where I pull that Station's corresponding Store ID, and THAT
Store's corresponding Phase. So my find looks like the following:
$products = $this->Station->Store->find('first', array('fields' =>
array('Store.id', 'Phase.phase'),'conditions' => array('Station.id' =>
$id)));
If I print_r($products) after that find, I get the following:
Array ( [Store] => Array ( [id] => 1 ) [Phase] => Array ( [phase] =>
Building For Staging ) )
Notice that that are 2 arrays: Store, and Phase.
The questions is: Is there anyway to make it so the array becomes:
Array ( [Store] => Array ( [id] => 1 [phase] => Building For Staging))
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
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