Re: Recover associated data of second level.
What about the "recursive" param on your params array?
http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#find
-- i.e:
$this->User->find('all', array('recursive' => 2));
Luiz Antonio S Messias
Desenvolvedor Web
--
Desenvolvedor Web
2012/5/12 J. <contact.mysparetime@gmail.com>
To Be more precise I have :User hasOne ProfileProfile belongsTo USerProfile HABTM CardCard HABTM ProfileSince profile belongs to User, How can I get its associated data (CArd) from the USer view ?
Le samedi 12 mai 2012 16:25:48 UTC+2, J. a écrit :Hi,
In my cake app I have :User hasOne Profile HasAndBelongsToMany CardWhen I find a user, I get this array :array( 'User' => array( 'password' => '*****', 'id' => '1', 'email' => '*******', 'username' => '******', ), 'Profile' => array( 'id' => '1', 'user_id' => '1', 'background' => 'galaxy.png', 'modified' => '2012-05-12 15:09:59' ) )When I find a profile I got this array :array( 'Profile' => array( 'id' => '1', 'user_id' => '1', 'background' => 'http://pierrebozon.com/galaxy.png', 'modified' => '2012-05-12 15:09:59' ), 'User' => array( 'password' => '*****', 'id' => '1', 'username' => '*****', 'created' => '2012-05-08 00:00:00' ), 'Card' => array( (int) 0 => array( 'id' => '1', 'label' => '', 'LicensesProfile' => array( 'id' => '1', 'profile_id' => '1', 'Card_id' => '1' ) ) ))How can I get Card info from the User view ? I mean something like this :array('User' => array( 'password' => '*****', 'id' => '1', 'email' => '*******', 'username' => '******', ), 'Profile' => array( 'id' => '1', 'user_id' => '1', 'background' => 'galaxy.png', 'modified' => '2012-05-12 15:09:59' 'Card' => array('id' => '1 ' etc)) )Thanks a lot !--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home