Closed ZeinEddin closed 10 years ago
Yes there was a change. The problem is that my custom paginator implementation don't cover all "edge cases" of possible count queries (but only uses 2 queries). Until some updates ago, always my paginator implementation was used, but there was a wrong COUNT result in some cases.
I've implemented a detection method, there i check if it's save to use my pagination: https://github.com/ThaDafinser/ZfcDatagrid/blob/master/src/ZfcDatagrid/DataSource/Doctrine2/Paginator.php#L60
Else the default doctrine one is used.
What type of database do you use?
This is the problem: I change the select part to the defined columns...which should not be done, befor the pagination. Your $qb is right, but i change it to the NOT WORKING
NOT working: 'SELECT c.id, c.number FROM Application\Entity\Course c' WORKING: 'SELECT c FROM Application\Entity\Course c'
I'll provide an update for this...
I am using Oracle
As far as i looked into the code, this is a nasty one.
Possible solution so far: Create a pagination wrapper for DoctrinePaginator, and use 2 $qb objects...one with the original select part for COUNT and one for the real select
The suggested solution is for the ZfcDatagrid itself not me, right? because in my code I am not using "count"... Can I help with anything to solve this issue? did you try anything?
@ZeinEddin i just tried now a quick solution....but that seems to be really hard...
Please try following: Always return true in following function: https://github.com/ThaDafinser/ZfcDatagrid/blob/master/src/ZfcDatagrid/DataSource/Doctrine2/Paginator.php#L60
Does that work for you?
NOTE "why it's hard":
My idea was to let the select original (only for counting), so the paginator from doctrine "would" work. (Like in your link above provided as example).
But the problem is that filtering is done on the columns of the grid, so they have to be selected too...
I just updated the module on one of the projects (an Oracle project) and it seems working fine, I will try to test it on more projects (mySQL and Oralce) and see what will happen.
It works now for you like in the original patch.
Mostly the pagination will be correct. But when using complex queries with having, grouping....the count result will be wrong.
This is working fine now for Oracle... closing...
I just got the latest updates of the ZfcDatagrid, and I am using it with Doctrin2, just selecting from one entity, and I got this error after the update:
In my action my code is simple as the following:
I noticed that there has been some changes in Doctrine files, do I have to change anything in my code?