我是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一样检索结果吗? –