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

Paginator broke with latest version Doctrine? #123

Closed
TheDevilOnLine opened this issue Nov 12, 2012 · 41 comments
Closed

Paginator broke with latest version Doctrine? #123

TheDevilOnLine opened this issue Nov 12, 2012 · 41 comments

Comments

@TheDevilOnLine
Copy link

I just updated my symfony using Composer (which also updated my Doctrine etc). All of a sudden I now get the error 'Invalid parameter number: number of bound variables does not match number of tokens'.

I was able to fix this by making a change to /vendor/knplabs/knp-components/src/Knp/Component/Pager/Event/Subscriber/Paginate/Doctrine/ORM/QuerySubscriber.php

I changed line 27 from

$useDoctrineWalkers = version_compare(\Doctrine\ORM\Version::VERSION, '2.2.0', '>=');

to

$useDoctrineWalkers = false;

My doctrine uses version 2.3.x-dev

@pulse00
Copy link

pulse00 commented Nov 13, 2012

I'm having the exact same issue. Something seems to have changed in doctrine, as there have been no real changes in this bundle since July 30.

@robmeek
Copy link

robmeek commented Nov 13, 2012

Having the same issue

@skydiablo
Copy link

I can confirm, have the same error

@Zorpen
Copy link

Zorpen commented Nov 13, 2012

Yep, same here.

@raulfraile
Copy link

Same here. Is there a workaround to get it working without editing the component itself?

@TheDevilOnLine
Copy link
Author

@raulfraile I'm still trying to figure that out. If I find a way, I'll post it in here as well!

@joericochuyt
Copy link

confirm

@kiddo13
Copy link

kiddo13 commented Nov 16, 2012

composer.phar update with dev-master knp-paginator-bundle, querysubscriber still gives the same error.
Do I have to update it manually? *New to github

@TheDevilOnLine
Copy link
Author

@kiddo13 for now you have to update it manually until the maintainers of the KnpPaginatorBundle accept the changes. For the correct change see the pull request @pulse00 made (mine is more of a quick fix)

P.s. Thanks @pulse00 for looking into this some more :-)

@pulse00
Copy link

pulse00 commented Nov 16, 2012

the fix has been merged into knp-components. @TheDevilOnLine actually @ChubV found the regression - i've just created the PR ;)

@blimeycreative
Copy link

Is this issue fixed? I have the latest knp-components commit ('Cleanup before tagging version 1.1.2') which includes the @pulse00 PR but I'm still getting the 'Invalid parameter number' error. Is anyone else still having this issue?

@ThomasBerthe
Copy link

I'm still having the same issue when the default_options 'distinct' is set to true.
Here is my configuration and my code :

knp_paginator:
    page_range: 5                      # default page range used in pagination control
    default_options:
        page_name: page                # page query parameter name
        sort_field_name: sort          # sort field query parameter name
        sort_direction_name: direction # sort direction query parameter name
        distinct: true                 # ensure distinct results, useful when ORM queries are using GROUP BY statements
    template:
        pagination: KnpPaginatorBundle:Pagination:sliding.html.twig     # sliding pagination controls template
        sortable: KnpPaginatorBundle:Pagination:sortable_link.html.twig # sort link template
$em = $this->getDoctrine()->getEntityManager();
$dql = "SELECT a FROM ProjectxAccountBundle:Account a";
$query = $em->createQuery($dql);
$oPaginator = $this->get('knp_paginator');
$aAccounts = $oPaginator->paginate(
   $query,
   $this->get('request')->query->get('page', 1),
   2
);

@kaiwa
Copy link

kaiwa commented Nov 19, 2012

+1 same issue is blocking me too

Edit: Setting distinct to false as mentioned by @ThomasBerthe is working

@blimeycreative
Copy link

Setting distinct to false worked for us too. The issue is still there, but this seems like a valid workaround for now.

@xtofthomas
Copy link

Thanks for the tips

@kevindew
Copy link

+1 getting the parameter problem as well (including trying the fix)

setting distinct to false has worked as a workaround

@jeremymarc
Copy link

any news about this issue ?

@ethanhann
Copy link

+1

1 similar comment
@geoffreytran
Copy link

+1

@stloyd
Copy link
Contributor

stloyd commented Feb 7, 2013

Did anyone tested latest changes? Many fixes were merged, so this should be fixed now.

@geoffreytran
Copy link

I just updated to the latest with doctrine 2.3.3 and this issue occurs.

Geoffrey Tran

On Feb 7, 2013, at 3:02 AM, Joseph Bielawski [email protected] wrote:

Did anyone tested latest changes? Many fixes were merged, so this should be fixed now.


Reply to this email directly or view it on GitHub.

@daFish
Copy link
Contributor

daFish commented Feb 7, 2013

I just updated to the latest hash this version and after that I got this issue.

@vrnagy
Copy link

vrnagy commented Feb 7, 2013

+1

Setting distinct to false as mentioned by @ThomasBerthe is working

@alrayyes
Copy link

alrayyes commented Feb 7, 2013

+1

Edit @ThomasBerthe workaround works for me too.

@MichaelHindley
Copy link

Confirming this issue as well with latest doctrine.

@bicpi
Copy link

bicpi commented Feb 7, 2013

+1

@iknowfoobar
Copy link

+1
@ThomasBerthe workaround works for me

@neoshadybeat
Copy link

+1

1 similar comment
@jsamouh
Copy link

jsamouh commented Feb 7, 2013

👍

@metalvarez
Copy link

setting distinc to false works but now when i set some filters to the query the pagination count breaks

@metalvarez
Copy link

i commented it out lines between 29 y 34 of /vendor/knplabs/knp-components/src/Knp/Component/Pager/Event/Subscriber/Paginate/Doctrine/ORM/QuerySubscriber.php and now works fine

/*if (version_compare(\Doctrine\ORM\Version::VERSION, '2.3.0', '>=')) {
$useDoctrineWalkers      = true;
$useDoctrineOutputWalker = true;
} else if (version_compare(\Doctrine\ORM\Version::VERSION, '2.2.0', '>=')) {
$useDoctrineWalkers      = true;
}*/

@iknowfoobar
Copy link

Switching back to any doctrine version before 2.3 fixes this for me.

@piotrkosytorz
Copy link

+1

@jjtorroglosa
Copy link

Same issue. Doing what @metalvarez proposes also works for me.

@entymon
Copy link

entymon commented Feb 13, 2013

I had the same problem and resolved this like @metalvarez. It works.

@kallosz
Copy link

kallosz commented Feb 14, 2013

+1 same problem

@PanzerLlama
Copy link

+1

@bicpi
Copy link

bicpi commented Feb 19, 2013

@metalvarez Using distrinct=false, my pagination count is broken, too - but only when the list contains a single item

@Ziumin
Copy link

Ziumin commented Feb 19, 2013

@bicpi try this PR, please KnpLabs/knp-components#48

@stloyd
Copy link
Contributor

stloyd commented Feb 20, 2013

Fix was merged, new version tagged, in next few mins should be available at packagist.

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

No branches or pull requests