Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle HAVING clause which does not accept alias in filter queries #1028

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MlleDelphine
Copy link
Contributor

To handle query from filter with necessary HAVING clause which does not accept alias

To handle query from filter with necessary HAVING clause which does not accept alias
Copy link
Collaborator

@npotier npotier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, and thank you for this PR.

Some changes need to be done in order to continue.

@@ -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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you add a parameter to this function, you should change its signature wich is actually

protected function getFieldName($column, $withAlias = false)

@@ -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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable $hasHaving comes from nowhere.

I guess that it should be $hasHavingClause given as parameter of the function ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants