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,))){