Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Database/Table/GroupedSelection.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ public function order(string $columns, ...$params)
/********************* aggregations ****************d*g**/


public function aggregation(string $function): int
/**
* @return mixed
*/
public function aggregation(string $function)
{
$aggregation = &$this->getRefTable($refPath)->aggregation[$refPath . $function . $this->sqlBuilder->getSelectQueryHash($this->getPreviousAccessedColumns())];

Expand Down
12 changes: 8 additions & 4 deletions src/Database/Table/Selection.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,9 @@ public function alias(string $tableChain, string $alias)
/**
* Executes aggregation function.
* @param string select call in "FUNCTION(column)" format
* @return mixed
*/
public function aggregation(string $function): int
public function aggregation(string $function)
{
$selection = $this->createSelectionInstance();
$selection->getSqlBuilder()->importConditions($this->getSqlBuilder());
Expand All @@ -490,26 +491,29 @@ public function count(string $column = NULL): int

/**
* Returns minimum value from a column.
* @return mixed
*/
public function min(string $column): int
public function min(string $column)
{
return $this->aggregation("MIN($column)");
}


/**
* Returns maximum value from a column.
* @return mixed
*/
public function max(string $column): int
public function max(string $column)
{
return $this->aggregation("MAX($column)");
}


/**
* Returns sum of values in a column.
* @return mixed
*/
public function sum(string $column): int
public function sum(string $column)
{
return $this->aggregation("SUM($column)");
}
Expand Down