protected function _verifyClause(GroupByClause $clause, $fields) { $fields = Arrays::fuse($fields); foreach ($clause->getFields() as $field) { unset($fields[$field->getField()]); } return empty($fields); }
public function groupBy($fields) { /** * @var $this IStatement */ $groupClause = new GroupByClause(); if (func_num_args() > 1) { foreach (func_get_args() as $field) { $groupClause->addField($field); } } else { if (is_array($fields)) { foreach ($fields as $field) { $groupClause->addField($field); } } else { $groupClause->addField($fields); } } $this->addClause($groupClause); return $this; }
public function testAssemble() { $clause = new GroupByClause(); $clause->addField((new FieldExpression())->setField('first')); $this->assertEquals('GROUP BY first', QueryAssembler::stringify($clause)); }