DbQuery: Add getter for GROUP BY clauses

Allows to override this in a child to provide group by clauses not
until they are actually required.

refs #9009
This commit is contained in:
Johannes Meyer 2015-06-18 09:29:58 +02:00
parent 4d72832933
commit 386447b847
1 changed files with 16 additions and 4 deletions

View File

@ -145,8 +145,9 @@ class DbQuery extends SimpleQuery
}
}
if ($this->group) {
$select->group($this->group);
$group = $this->getGroup();
if ($group) {
$select->group($group);
}
$select->columns($this->columns);
@ -321,8 +322,9 @@ class DbQuery extends SimpleQuery
{
// TODO: there may be situations where we should clone the "select"
$count = $this->dbSelect();
if ($this->group) {
$count->group($this->group);
$group = $this->getGroup();
if ($group) {
$count->group($group);
}
$this->applyFilterSql($count);
if ($this->useSubqueryCount || $this->group) {
@ -393,6 +395,16 @@ class DbQuery extends SimpleQuery
return $this;
}
/**
* Return the GROUP BY clause
*
* @return string|array
*/
public function getGroup()
{
return $this->group;
}
/**
* Return whether the given table has been joined
*