我是cakephp3
中的新成員。我試圖執行下面的查詢,但它顯示我的錯誤。cakephp 3查詢未執行
$lifeinsurances = TableRegistry::get('LifeInsurances')->find("all");
$life_insurances = $lifeinsurances->find()
->join([
'table' => 'institutions',
'alias' => 'institutions',
'type' => 'LEFT',
'conditions' => 'institutions.id = LifeInsurances.institute_id',
]);
我修復了以前的查詢。現在我只能獲得一個表格數據。
編輯
現在我用蛋糕烘焙創建的關聯。但是這次顯示新的錯誤。以下是我的代碼。
public function index() {
$this->paginate = [
'contain' => ['Institutions']
];
$lifeInsurances = $this->paginate($this->LifeInsurances);
$this->set(compact('lifeInsurances'));
$this->set('_serialize', ['lifeInsurances']);
}
內部服務器錯誤
如果我刪除
$this->paginate = [
'contain' => ['Institutions']
];
$lifeInsurances = $this->paginate($this->LifeInsurances);
錯誤停止顯示
我沒有任何關聯。我可以像加入蛋糕2.x一樣檢索結果嗎? –