【发布时间】:2013-09-26 10:31:45
【问题描述】:
我有一些使用可包含的深层关联,需要过滤结果。对于这个问题,假设我们正在销售汽车并希望按功能缩小结果范围。
Car hasmany make hasmany model HABTM features
$options = array(
'order' => array('Car.price'),
'contain' => array(
'make',
'model' => array(
'order' => 'Model.name ASC'
),
'features'
)
);
$cars = $this->Car->find('all', $options);
我将如何排除所有没有电动车窗的汽车(Features.name != power_windows)。
【问题讨论】:
标签: cakephp associations conditional-statements containable