views:

236

answers:

1

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

A: 

Your approach generates too many queries. You may want to reduce their quantity by binding and unbinding models. See details here.

bancer