我需要“包含”2个父表。
Country hasMany Proponent and Proponent hasMany Project(见图片)
这包含什么错误:
$params["contain"] = array(
'Proponent' => array(
'fields' => array('id', 'name'),
'Country' => array('fields'=>array('id','name'))
)
);
Country模型不会仅仅返回结果Proponent,我怀疑这是获得父母的父母的限制。
型号:
更多的调试,如果我从Country to Project开始一切正常但是还原国家不会回归:
debug(ClassRegistry::init("Country")->find('all', array(
'fields' => array("id", "name"),
'conditions' => array('Country.id' => 33),
'contain' => array(
'Proponent' => array(
'fields' => array("id", "name"),
'Project' => array('fields' => array('id', 'name')
)
)
)
)
));
debug(ClassRegistry::init("Project")->find('all', array(
'fields' => array("id", "name"),
'contain' => array(
'Proponent' => array(
'fields' => array("id", "name"),
'Country' => array('fields' => array('id', 'name')
)
)
)
)
));
观测值:
任何提示?
确认,任何包含“父母 - >父母”包含第一个父母,OMG !!!!!!!!!!!!!!!!!!!