-
Notifications
You must be signed in to change notification settings - Fork 141
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
Add support for Doctrine ORMv3/DBALv4 #333
Conversation
//reset count orderBy since it can break query and slow it down | ||
$qb | ||
->resetQueryPart('orderBy') | ||
; | ||
|
||
if (method_exists($qb, 'resetOrderBy')) { | ||
$qb->resetOrderBy(); | ||
} else { | ||
$qb->resetQueryParts(['orderBy']); | ||
} | ||
|
||
// get the query | ||
$sql = $qb->getSQL(); | ||
|
||
$qb | ||
->resetQueryParts() | ||
->select('count(*) as cnt') | ||
->from('(' . $sql . ')', 'dbal_count_tbl') | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resetQueryParts()
has been removed in DBALv4.
Removing ->from()
makes the test pipeline green.
However, I'm not sure if this could cause any side effects.
Without this change $qb->getSQL()
would return SELECT count(*) as cnt FROM Article a, (SELECT * FROM Article a) dbal_count_tbl
which would lead to the result 16
instead of 4
In master
, $qb->getSQL()
returns SELECT count(*) as cnt FROM (SELECT * FROM Article a) dbal_count_tbl
.
…Manager is public
…rts() is not available anymore in newer DBAL versions
Fixes the prefer-lowest test pipeline
This PR is built on top of #331 and tries to fix the remaining compatibility issues.
Fixes #328