CakePhp: model recursive associations and find
Posted
by Petecocoon
on Stack Overflow
See other posts from Stack Overflow
or by Petecocoon
Published on 2010-05-28T13:40:25Z
Indexed on
2010/05/28
13:42 UTC
Read the original article
Hit count: 244
Hello to everybody!
I've some trouble with a find() on a model on CakePhp.
I have three model relationed in this way:
Project(some_fields, item_id) ------belongsTo-----> Item(some_fields, item_id) ------belongsTo-----> User(some_fields campi, nickname)
I need to do a find() and retrieve all fields from project, a field from Item and the nickname field from User. This is my code:
$this->set('projects', $this->Project->find('all', array('recursive' => 2)));
but my output doesn't contains the user object. I've tried with Containable behaviour but the output is the same. What is broken?
Many many Thanks
Peter
© Stack Overflow or respective owner