cakephp3でcontainしたテーブル(T2)にwhere句を設定したとき、下記のように
$user_ids を function ($q)...の中で使いたいのですが方法があるでしょうか?
実行すると
Undefined variable: user_ids
とエラーになってしまいます。
php
1$user_ids = array(1,2,3); 2$result = $this->T1->find() 3 ->contain(['T2'=> 4 5 function ($q) { 6 return $q 7 ->where(['T2.user_id IN' => $user_ids]); 8 } 9]); 10
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/10/31 01:15