我使用cakephp 2.1.1。 这是我的桌子协会:x hasmany y hasmany z hasmany w。CakePHP 2.1.1。可容忍的行为不起作用
一切都是正确的设置我想,但是当我做这个查询:
$conditions = array(
'contain' => array(
'y' => array (
'z' => array(
'w'=> array(
'conditions' => array('col>=' => $q))
)
)
));
$this->loadmodel('x');
$o=$this->x->find('all',$conditions);//array(
debug($o);
我没有我想要的结果;只有表格x被提取!为什么? 例如,这是我的模型X的PHP代码,类似于其他:
<? php
class x extends AppModel
{
var $name='x';
public $actsAs = array('Containable');
public $hasMany = array('y');
}
也许CakePHP的版本? 谢谢!
信息:我要让声明是这样的:
select z.col1, y.col2, x.col3
from z, y, x, w
where w.col>= 3
and w.z_id = z.id
and z.y_id = y.id
and z.x_id = x.id