belongsToManyの絞り込みにはmatching()かinnerJoinWith()を使います https://book.cakephp.org/3/ja/orm/retrieving-data-and-resultsets.html#matching-joins クエリを組み立てるのに慣れてきました。結合用のテーブルを間に挟んでいます。特に気にしなくてよいみたいです。
画像1

この記事が気に入ったらサポートをしてみませんか?