Document what count() is supposed to return#1468
Merged
dunglas merged 2 commits intoapi-platform:2.1from Nov 2, 2017
Merged
Conversation
dunglas
reviewed
Oct 31, 2017
|
|
||
| /** | ||
| * Paginator Interface. | ||
| * Paginator Interface. The \Countable implementation should return the number |
Member
There was a problem hiding this comment.
We can even remove Paginator Interface.. This comments brings nothing.
added 2 commits
October 31, 2017 15:49
count() could return the number of pages, or the total number of items, or the number of items on the current page. Looking at the doctrine ORM implementation, it looks like it should be the number of items on the current page, so let's document that, maybe it is relied on somewhere?
40f9661 to
e57f989
Compare
Contributor
Author
|
Does anyone know when this method is supposed to be called by the way? If it is unused, I think it should be removed. I tried throwing an exception in it, and I have yet to see any page break. |
Contributor
Author
|
@dunglas I think you found a bug, because the result is assigned to EDIT: Oh sorry I didn't read the whole condition, this is not a bug, it makes some sense. |
Contributor
Author
|
@dunglas but if the object is not |
Closed
Member
|
Thanks @greg0ire |
hoangnd25
pushed a commit
to hoangnd25/core
that referenced
this pull request
Feb 23, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
count()could return the number of pages, or the total number of items, or the number of items on the current page. Looking at the doctrine ORM implementation, it looks like it should be the number of items on the current page, so let's document that, maybe it is relied on somewhere?I'm contributing this on 2.1, but on master the implementation was moved in an abstract class. Here is how it looks:
core/src/Bridge/Doctrine/Orm/AbstractPaginator.php
Lines 71 to 74 in c7e2cda