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
Doctrine\ORM\EntityRepositoy::count invalid type hint #7523
Comments
Changing the signature is not really feasible due to inheritance anymore. If you want to fix it, it should target |
Due to what inheritance?! The method ::count is on EntityRepository and only there. So fix type signature is not hard thing, just remove array. I did it myself, but it's really annoying doing it on every project. EntityPersister::count() still isn't typed and is annotated accepting array or Criteria. Remove array type doesn't break anything. |
@bednic If anyone has extended EntityRepository, then it's actually a problem. |
@Tomsgu It shouldn't be, cause if u have right setup on environment, then warnings are suppresed. And non-matching method type signatures are warning, not error. But OK, this is "privilege" of PHP. So there is another solution, like add new method, ::countByCriteria which will accept Criteria object. Then everybody will be happy. But someone screw this up, so would be nice, if it get fixed. IMHO even in big project this fix is like findAll > replace ... Who actually has multiple Entity-Repositories in project where is overwriting base methods like count. |
A lot of folks, which is why this is labeled as such. Closing as per my initial labeling in #7523 (comment) |
Bug Report
Summary
Doctrine\ORM\EntityRepository::count(array $criteria)
should beDoctrine\ORM\EntityRepository::count($criteria)
, because it callsDoctrine\ORM\Persister\Entity\EntityPersister::count
which acceptsarray|\Doctrine\Common\Collections\Criteria
as argument.The text was updated successfully, but these errors were encountered: