検索機能があり、スタッフにはありがたいので、名前で検索できます。今、staffgroup.groupname でスタッフをフィルター処理したいのですが、残念ながら次のエラーが発生します。
Column not found: 1054 Unknown column 'staffgroups.groupname' in 'where clause'
私は次のテーブルレイアウトを持っています
- スタッフ(人は多くのグループに所属できます)
- staff_staffgroups (HABTM リンクテーブル)
- staffgroups (グループ名を持っています)
私は次のように条件を使用しました:
$tmpConditions['AND'][] = array('Staff.isActive =' => "1");
$tmpConditions['OR'][] = array('Staff.lastname LIKE' => "%$name%");
$tmpConditions['OR'][] = array('staffgroups.groupname LIKE' => "%$group%");
[...]
$this->Staff->recursive = 1;
$this->paginate = array('conditions' => $tmpConditions );
$this->set('staffs', $this->paginate());
条件は正しく設定されていると思いますが、うまく機能しません。
乾杯遠藤