[doc] Repository method count does not exist #5278

Closed
opened 2026-01-22 15:03:16 +01:00 by admin · 6 comments
Owner

Originally created by @mcorteel on GitHub (Sep 30, 2016).

Originally assigned to: @Ocramius on GitHub.

The documentation references a convenience method of entity repositories named count.

Like this comment on stackoverflow states, it would be a great addition to the EntityRepository, but it doesn't actually exist (reference).

Originally created by @mcorteel on GitHub (Sep 30, 2016). Originally assigned to: @Ocramius on GitHub. The [documentation](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/working-with-objects.html#by-simple-conditions) references a convenience method of entity repositories named `count`. Like this comment on stackoverflow states, it would be a great addition to the `EntityRepository`, but it doesn't actually exist ([reference](http://www.doctrine-project.org/api/orm/2.5/class-Doctrine.ORM.EntityRepository.html)).
admin added the BugDocumentationIncomplete labels 2026-01-22 15:03:16 +01:00
admin closed this issue 2026-01-22 15:03:16 +01:00
Author
Owner

@lcobucci commented on GitHub (Sep 30, 2016):

@mcorteel that method is definitely available for 2.6 but probably not for 2.5.x

@lcobucci commented on GitHub (Sep 30, 2016): @mcorteel that method is definitely available for 2.6 but probably not for 2.5.x
Author
Owner

@mcorteel commented on GitHub (Sep 30, 2016):

Then I think it should be mentioned in the documentation. Shouldn't it?

@mcorteel commented on GitHub (Sep 30, 2016): Then I think it should be mentioned in the documentation. Shouldn't it?
Author
Owner

@Ocramius commented on GitHub (Sep 30, 2016):

Fairly sure that those docs aren't referencing the correct branch... To be checked in https://github.com/doctrine/doctrine-website-sphinx, I suppose.

@Ocramius commented on GitHub (Sep 30, 2016): Fairly sure that those docs aren't referencing the correct branch... To be checked in https://github.com/doctrine/doctrine-website-sphinx, I suppose.
Author
Owner

@yannickl88 commented on GitHub (Apr 12, 2017):

Is this still an issue? As far as I can tell the docs are not referencing any branch directly (via a link or some sorts).

Would an acceptable fix for this to add a line to the current docs that the count method has been added in 2.6 suffice? I.e.,:

New in version 2.6.

Additionally, you can just count the result of the provided conditions when you don't really need the data:

    <?php
    // Check there is no user with nickname
    $availableNickname = 0 === $em->getRepository('MyProject\Domain\User')->count(['nickname' => 'nonexistent']);
@yannickl88 commented on GitHub (Apr 12, 2017): Is this still an issue? As far as I can tell the docs are not referencing any branch directly (via a link or some sorts). Would an acceptable fix for this to add a line to the current docs that the `count` method has been added in 2.6 suffice? I.e.,: > _New in version 2.6._ > > Additionally, you can just count the result of the provided conditions when you don't really need the data: > ```php > <?php > // Check there is no user with nickname > $availableNickname = 0 === $em->getRepository('MyProject\Domain\User')->count(['nickname' => 'nonexistent']); > ```
Author
Owner

@mcorteel commented on GitHub (Apr 13, 2017):

Yes, that would fix it!

@mcorteel commented on GitHub (Apr 13, 2017): Yes, that would fix it!
Author
Owner

@Ocramius commented on GitHub (Apr 13, 2017):

Moved to https://github.com/doctrine/doctrine-website-sphinx/issues/149 - closing here

@Ocramius commented on GitHub (Apr 13, 2017): Moved to https://github.com/doctrine/doctrine-website-sphinx/issues/149 - closing here
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5278