Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以在 cakephp 模型中与某些特定条件建立关系:例如:
var $belongsTo = array( 'Parent' => array( 'className' => 'Category', 'foreignKey' => 'parent_id', 'dependent' => true ) );
parent_id我想要关于 where field is not的上述关系0。请概述如何做到这一点?
parent_id
0
您可以像使用 find 一样在关系中添加条件。
var $belongsTo = array( 'Parent' => array( 'className' => 'Category', 'foreignKey' => 'parent_id', 'dependent' => true, 'conditions' => array( ... ) ) );