5
我有表學期,學科和jointTable Semesters_Disciplines。我希望在DisciplinesController中創建一個以semester_id作爲參數的動作索引,該參數列表只包含與參數中傳遞的id相關的學期屬性。我嘗試這樣做:分段條件belongsToMany CakePHP 3
public function index($semester_id)
{
$options = ['semester_id' => $semester_id];
$this->paginate = ['conditions' => $options];
$this->set('disciplines', $this->paginate($this->Disciplines));
$this->set('_serialize', ['disciplines']);
}
你對測試的結果,併發生了什麼,你是或者沒有想到? – Milner
錯誤:SQLSTATE [42S22]:未找到列:1054'where子句'中的未知列'semesters_id' 呃...'條件'只是接受與控制器模型有關的條件... – Luiz