cakephp查找列表

时间:2011-08-01 20:24:41

标签: cakephp

任何人都可以告诉我如何查询清单。

这可以吗?

$part1Achiveds = $this->Part2Achived->Part1Achived->ProComp->find('list',array('conditions='=>array('ProComp.id=Part2Achiveds.pro_comp_id')));

1 个答案:

答案 0 :(得分:0)

Key =>价值优于您的工作:

$part1Achiveds = $this->Part2Achived->Part1Achived->ProComp->find('list',array(
    'conditions='=>array(
        // Model.field => Model.field instead of Model.field = Model.field
        $this->ProComp->alias.'id' => $this->Part2Achived->alias.'.pro_comp_id'
    )
));

您还应该检查您的递归和关联。时间:

Part2Achived-> Part1Achived-> PROCOMP

ProComp与Part2Achived相距2个递归距离,因此设置递归为2或使用Containable。