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

Fixed: Attempted to call an undefined method named "count" of class " Doctrine\ODM\MongoDB\Query\Query". in DoctrineODMMongoDBAdapter #279

Merged
merged 1 commit into from
Jul 17, 2019

Conversation

michaelbagrov
Copy link

Problem:
When using DoctrineODMMongoDBAdapter and calling any method which uses Pagerfanta::getNbResults receiving error: ttempted to call an undefined method named "count" of class " Doctrine\ODM\MongoDB\Query\Query".

…Doctrine\ODM\MongoDB\Query\Query". in DoctrineODMMongoDBAdapter
@michaelbagrov
Copy link
Author

Any update on this?

@stof
Copy link
Contributor

stof commented Jul 9, 2019

/cc @jmikola

Copy link

@jmikola jmikola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume I was just tagged for a technical review as I'm not a maintainer on this repository and cannot merge this (see: #278).

Arguments about using counts for pagination aside, this looks like the correct change to ensure forward-compatibility with ext-mongodb, as MongoDB\Driver\Cursor does not provide a count() method as was found on MongoCursor from ext-mongo.

Cloning the query builder and clearing its limit/skip also seems wise.

@sampart sampart merged commit a53ff01 into whiteoctober:master Jul 17, 2019
@sampart
Copy link
Collaborator

sampart commented Jul 17, 2019

Great to have your input, @michaelbagrov, thanks for this. And thank you for your technical review, @jmikola.

I've merged this now as you'll see and included it in release https://github.com/whiteoctober/Pagerfanta/releases/tag/v2.1.3.

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

Successfully merging this pull request may close these issues.

4 participants