From edb66678047c2d053d9c1e2f584338fc18e0aabc Mon Sep 17 00:00:00 2001 From: MlleDelphine Date: Thu, 31 Jan 2019 14:23:15 +0100 Subject: [PATCH] Handle HAVING clause which does not accept alias To handle query from filter with necessary HAVING clause which does not accept alias --- Grid/Source/Entity.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Grid/Source/Entity.php b/Grid/Source/Entity.php index 78cc0f99..a57f6464 100644 --- a/Grid/Source/Entity.php +++ b/Grid/Source/Entity.php @@ -245,6 +245,10 @@ protected function getFieldName($column, $withAlias = false) return "$functionWithParameters as $alias"; } + // To handle query from filter with necessary HAVING clause which does not accept alias + if (!$withAlias && $hasHaving) { + return $functionWithParameters; + } return $alias; } @@ -437,7 +441,7 @@ public function execute($columns, $page = 0, $limit = 0, $maxResults = null, $gr $columnForFilter = (!$column instanceof JoinColumn) ? $column : $columnsById[$filter->getColumnName()]; - $fieldName = $this->getFieldName($columnForFilter, false); + $fieldName = $this->getFieldName($columnForFilter, false, $hasHavingClause); $bindIndexPlaceholder = "?$bindIndex"; if( in_array($filter->getOperator(), array(Column::OPERATOR_LIKE,Column::OPERATOR_RLIKE,Column::OPERATOR_LLIKE,Column::OPERATOR_NLIKE,))){