Good evening to all.
I am newly using a new version of CakePHP strawberry.
I have two tables (Categories and Products).
The categories has many prodoucts and products belongs to one category
I define the relation betwwen them like this
$this->belongsTo(‘Categories’);
$this->hasMany(‘Products’)->setForeignKey(‘category_id’)->setDependent(true);
The question I need to view all categories name inside the index of products like this
product id / product name / category name
in previous version that i use the behviours {Containable}
in this version i use like this
$this->paginate = [
'contain' => ['Categories'],
];
and I use to like this
$this->Products->find(‘all’)->leftJoinWith(‘Categories’);
but unfortunetly no way works with me
Any suggestions for that .Thank you