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

Fix join queries #828

Closed
wants to merge 5 commits into from
Closed

Conversation

patgrudniewski
Copy link
Contributor

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.

@patgrudniewski
Copy link
Contributor Author

bug fixed

@hmert
Copy link
Contributor

hmert commented Mar 14, 2016

@APY/collaborators Votes open :)

@qferr
Copy link
Contributor

qferr commented Mar 16, 2016

@APY/collaborators We need to tests this PR.

@dbdig-jenkins
Copy link

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

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

Copy link
Contributor Author

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 :)

@hmert hmert added this to the 2.3 milestone Sep 15, 2016
hmert added a commit that referenced this pull request Oct 1, 2016
and added #828 (comment)

# Conflicts:
#	DependencyInjection/Configuration.php
#	Grid/Grid.php
#	Twig/DataGridExtension.php
@hmert
Copy link
Contributor

hmert commented Oct 1, 2016

will merge into #878

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

Successfully merging this pull request may close these issues.

6 participants