Beispiel #1
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;
 }
 public function testAssemble()
 {
     $clause = new GroupByClause();
     $clause->addField((new FieldExpression())->setField('first'));
     $this->assertEquals('GROUP BY first', QueryAssembler::stringify($clause));
 }