public function testGroupBy() { $group_by = array(new Field('year')); $q = new SelectQuery(array('test')); $q->setGroupby($group_by); $this->assertEquals('SELECT `t0`.* FROM `test` AS `t0` GROUP BY `t0`.`year`', $q->sql()); $q->setHaving(new Condition('>', new Aggregate('count', new Field('commit')), 20)); $this->assertEquals('SELECT `t0`.* FROM `test` AS `t0` GROUP BY `t0`.`year` HAVING COUNT(`t0`.`commit`) > :p1', $q->sql()); $q->setHaving(); $this->assertEquals('SELECT `t0`.* FROM `test` AS `t0` GROUP BY `t0`.`year`', $q->sql()); $this->assertEquals(var_export($group_by, true), var_export($q->showGroupBy(), true)); // check required by BebopCMS(tm) }
function fill(SelectQuery $selectQuery, EntityQueryBuilder $builder) { $selectQuery->setHaving($this->expression->toSubjected($builder)); }