예제 #1
0
 protected function _verifyClause(GroupByClause $clause, $fields)
 {
     $fields = Arrays::fuse($fields);
     foreach ($clause->getFields() as $field) {
         unset($fields[$field->getField()]);
     }
     return empty($fields);
 }
예제 #2
0
 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;
 }
예제 #3
0
 public function testAssemble()
 {
     $clause = new GroupByClause();
     $clause->addField((new FieldExpression())->setField('first'));
     $this->assertEquals('GROUP BY first', QueryAssembler::stringify($clause));
 }