Nette\Database\Table\Selection::group PHP Метод

group() публичный Метод

Sets group clause, more calls rewrite old value.
public group ( $columns, $params ) : self
Результат self
    public function group($columns, ...$params)
    {
        $this->emptyResultSet();
        $this->sqlBuilder->setGroup($columns, ...$params);
        return $this;
    }

Usage Example

Пример #1
0
 public function aggregation($function)
 {
     $aggregation =& $this->refTable->aggregation[$function . implode('', $this->where) . implode('', $this->conditions)];
     if ($aggregation === NULL) {
         $aggregation = array();
         $selection = new Selection($this->name, $this->connection);
         $selection->where = $this->where;
         $selection->parameters = $this->parameters;
         $selection->conditions = $this->conditions;
         $selection->select($function);
         $selection->select("{$this->name}.{$this->column}");
         $selection->group("{$this->name}.{$this->column}");
         foreach ($selection as $row) {
             $aggregation[$row[$this->column]] = $row;
         }
     }
     if (isset($aggregation[$this->active])) {
         foreach ($aggregation[$this->active] as $val) {
             return $val;
         }
     }
 }