Nette\Database\Table\GroupedSelection::aggregation PHP Method

aggregation() public method

******************* aggregations ****************d*g*
public aggregation ( $function )
    public function aggregation($function)
    {
        $aggregation =& $this->getRefTable($refPath)->aggregation[$refPath . $function . $this->sqlBuilder->getSelectQueryHash($this->getPreviousAccessedColumns())];
        if ($aggregation === NULL) {
            $aggregation = [];
            $selection = $this->createSelectionInstance();
            $selection->getSqlBuilder()->importConditions($this->getSqlBuilder());
            $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;
            }
        }
    }