查询操作中数组的Cakephp AND约束


Cakephp AND constraint for array in query operation

我有一个需要加入查询的表计划。

$joins[] = array(
    'table' => 'schedules',
    'alias' => 'Schedule',
    'conditions' => array(
         'Schedule.provider_id = Provider.id',
         'Schedule.endtime > "' . date('Y-m-d H:i:s') . '"',
         'Schedule.starttime' => $startTimes,
    ),
    'type' => 'INNER'
);

$starttimes是一个由DateTime对象组成的数组。提供程序可以有多个时间表,我希望获得所有提供程序,它们至少与$starttimes数组中的所有启动时间相匹配。

感谢ndm,我得到了解决方案。我错过的是集体演讲:

$group = 'Provider.id HAVING COUNT(DISTINCT Schedule.id) = ' . count($startTimes);