Skip to content

Commit

Permalink
Merge pull request #13 from northernco/column-use-having
Browse files Browse the repository at this point in the history
Add a setting to use having for column filtering
  • Loading branch information
natewiebe13 authored Dec 10, 2021
2 parents 0aed716 + e575f7f commit 4eff124
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Grid/Column/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ abstract class Column
protected $export;
protected $class;
protected $isManualField;
protected $useHaving;
protected $isAggregate;
protected $usePrefixTitle;
protected $translationDomain;
Expand Down Expand Up @@ -156,6 +157,7 @@ public function __initialize(array $params)
$this->setValues($this->getParam('values', []));
$this->setOperatorsVisible($this->getParam('operatorsVisible', true));
$this->setIsManualField($this->getParam('isManualField', false));
$this->setUseHaving($this->getParam('useHaving', false));
$this->setIsAggregate($this->getParam('isAggregate', false));
$this->setUsePrefixTitle($this->getParam('usePrefixTitle', true));

Expand Down Expand Up @@ -1010,6 +1012,16 @@ public function getIsManualField()
return $this->isManualField;
}

public function setUseHaving($useHaving)
{
$this->useHaving = $useHaving;
}

public function getUseHaving()
{
return $this->useHaving;
}

public function setIsAggregate($isAggregate)
{
$this->isAggregate = $isAggregate;
Expand Down
2 changes: 1 addition & 1 deletion Grid/Source/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ public function execute($columns, $page = 0, $limit = 0, $maxResults = null, $gr
$isDisjunction = $column->getDataJunction() === Column::DATA_DISJUNCTION;

$dqlMatches = [];
$hasHavingClause = $column->hasDQLFunction($dqlMatches) || $column->getIsAggregate();
$hasHavingClause = $column->hasDQLFunction($dqlMatches) || $column->getIsAggregate() || $column->getUseHaving();
if(isset($dqlMatches['function']) && $dqlMatches['function'] == 'translation_agg'){
$hasHavingClause = false;
}
Expand Down

0 comments on commit 4eff124

Please sign in to comment.