-
Notifications
You must be signed in to change notification settings - Fork 342
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
Fix join queries #828
Fix join queries #828
Conversation
use doctrine paginator to get results
check if join is fetch join
bug fixed |
@APY/collaborators Votes open :) |
@APY/collaborators We need to tests this PR. |
What's the status of this? not being able to use joins without breaking pagination makes this bundle pretty useless... can this get a bump in priority? |
{ | ||
$join = $qb->getDqlPart('join'); | ||
foreach ($join[$this->getTableAlias()] as $join) { | ||
if ($join->getJoinType() === Join::INNER_JOIN) { |
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.
The join type doesn't matter. The check should be if (joined entity is also present in select)
imo
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.
I'm pretty sure that join type matter. I cannot explained that, because I wrote that in February, but I'm pretty sure that it was caused by bug found by my former team's QA.
There was some kind of uncompatibility with Doctrine's paginator when there was just
$hasJoin = !empty($this->query->getDqlPart('join'))
. I believe that Paginator
couldn't been created successfully when new Paginator($query, true)
constructor was called for not fetch joined query.
I'm sorry that I cannot tell you more but I haven't been working at project I was using APYDataGridBundle for 4 months.
For more details you have to ask Pixers, they forked my repo and I believe there're still using APYDataGridBundle. Also their QA team had found bug I fixed here :)
and added #828 (comment) # Conflicts: # DependencyInjection/Configuration.php # Grid/Grid.php # Twig/DataGridExtension.php
will merge into #878 |
Bug description:
When trying to show in grid results of query which was using Doctrine's fetch join there was problem with pagination and numbers of results showed in grid.
Error was caused because in code SQL querry LIMIT clause was used - with fetch join of one to many relationship LIMIT cannot be used because number of SQL rows is bigger than number of grid rows (Doctrine is hydrating it to main table's entity object).
Because of that pagination was not working and not all results was showed, because of LIMIT clause in SQL querry.