我是新来的cakephp3
。我正在尝试执行以下查询,但它显示错误。
$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);
错误停止显示