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

[doc] Repository method count does not exist #6060

Closed
mcorteel opened this issue Sep 30, 2016 · 6 comments
Closed

[doc] Repository method count does not exist #6060

mcorteel opened this issue Sep 30, 2016 · 6 comments

Comments

@mcorteel
Copy link

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).

@lcobucci
Copy link
Member

lcobucci commented Sep 30, 2016

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

@mcorteel
Copy link
Author

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

@Ocramius
Copy link
Member

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

@yannickl88
Copy link
Contributor

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']);

@mcorteel
Copy link
Author

Yes, that would fix it!

@Ocramius
Copy link
Member

Moved to doctrine/doctrine-website-sphinx#149 - closing here

@Ocramius Ocramius self-assigned this Apr 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants