![見出し画像](https://assets.st-note.com/production/uploads/images/133871817/rectangle_large_type_2_14b3c6133fc8c632a518893284f15244.png?width=800)
結合テーブルに条件をつけるのはクエリビルダを使いました
まさかcontainにもクエリビルだが使えるとは
$query = $categories->find();
$query->contain('Items', function ($q) {
return $q->where(['Items.status' => 1);
});
https://book.cakephp.org/3/ja/orm/retrieving-data-and-resultsets.html#id12
この記事が気に入ったらサポートをしてみませんか?