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;
}
}
}