0
coding
TABELcakephp的3模型不相关的误差
id | level1 | level2 | title _____________________________________ 1 | 100 | 1 | numberOne 2 | 100 | 2 | NumberTwo 3 | 101 | 1 | Compay 4 | 101 | 2 | association
表Organizations
id | name | type | level ____________________________ 1 | intel | 3 | 1 2 | IBM | 4 | 2
模型Organizations
class organizationsTable extends table
{
public function initialize(array $config)
{
$this->table('organizations');
$this->primaryKey('id');
$this->belongsTo('yyyy', [
'foreignKey' => 'type',
'className' => 'coding'
],
'xxxx', [
'foreignKey' => 'level',
'className' => 'coding'
]);
}
}
控制器
$organization->find('all')->contain(['yyyy'])->contain(['xxxx'])->toList() ;
我写这篇文章,但说错误:organizations is not associated with xxxx
怎么办多重关系到cakephp3相同的模型?