In my Menus controller, I am using:
$recipes = $this->Menus->MenuSections->MenuEntries->Recipes->find('all') ->select(['name','id', 'Ingredients.name', 'Ingredients.id', 'IngredientTypes.name']) ->contain(['Ingredients', 'Ingredients.IngredientTypes']);
The aim being to print a table of recipes, each with its primary ingredient and associated ingredient type. Then, I can design a new menu by choosing a recipe according to the specific ingredient (or ingredient type) I want to use at the time. (In the future, this will be a jQuery lookup routine, but for now I’m just trying to get my app working from start to finish).
Cake outputs an SQL error:
Column not found: 1054 Unknown column ‘Ingredients.name’ in ‘field list’
If I remove the select statement, the query runs fine, but it gives me all the columns from all three tables.
The docs led me to believe the query I’m trying to assemble should be easily supported.