mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Failed count entities with multiple identifiers #5730
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @peter-gribanov on GitHub (Oct 5, 2017).
Originally assigned to: @lcobucci on GitHub.
Entity:
Query:
Result:
For resolve this problem i must use concrete field in
COUNT():But this is not always possible 1, 2.
@peter-gribanov commented on GitHub (Oct 6, 2017):
I can't use specifications because of this problem:
I have to use a QueryBuilder:
There is another way to solve the problem. Add
idfield and make it as primary key.But
idis only needed for Doctrine. In project, it is not needed.FavoriteNews with id
@peter-gribanov commented on GitHub (Oct 6, 2017):
I don't understand why we can't transform DQL:
into SQL:
@lcobucci commented on GitHub (Nov 26, 2017):
@peter-gribanov we have to consider that
COUNT(*),COUNT(id), andCOUNT(1)have different behaviour (specially if you have nullable fields) and since the ORM cannot infer which behaviour the user wants when having composite fields it expects the user to provide the correct field(s). So unfortunately this is something we won't otherwise it might break things.It's also important to state that
COUNT(*)is not recommended because it will potentially block writing operations for some specific platforms.@lcobucci commented on GitHub (Nov 26, 2017):
I'll close this issue as
Can't Fixdue to given explanation.