SitesTable.php で $this->belongsTo('Ftps');
をしてあります。
Ftps の user_id が 100の Sites データを取得したいのですが、
以下の方法だと条件が効きません。
どうすれば
Ftps.user_id 100 の Sites データをのみ取得できますか?
php
1 2 $query = $this->Sites->find() 3 //関連モデルを条件を指定して読みだす 4 ->contain([ 5 'Ftps' => function ($q) { 6 return $q 7 ->where(['user_id' => 100]); 8 } 9 ]); 10 11 $sites = $this->paginate($query);
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/09/10 09:44
2016/09/10 11:19