Specify fields in a recursive find with cakephp
- by Razor Storm
Suppose I have a table Recipe that hasmany ingredients.
I do a recursive find to grab recipes with their associated ingredients:
$this->Recipe->find('all', array('fields' => array('id','title','description')));
Here I can use the 'fields' attribute to specify that I only want it to return id, title, and description. However, despite this, cakephp still returns ALL columns from the ingredients table.
How do I tell cakephp that I only want ingredient table's id and name fields?
btw ingredient model is "Ingredient" and the table is ingredients, and the aggregation table is recipes_ingredients.