[DOCTRINE_COLLECTION_22] constant to enum error for querybuilder
Closed this issue ยท 5 comments
When i use DOCTRINE_COLLECTION_22
it will replace my Doctrine\\Common\\Collections\\Criteria::DESC
to Doctrine\Common\Collections\Order::DESCbut this causes the following error:
TypeError: Doctrine\ORM\QueryBuilder::orderBy(): Argument #2 ($order) must be of type ?string, Doctrine\Common\Collections\Order given, called in /srv/Repository/BlogRepository.php on line 103`
The replacement should actually be Doctrine\\Common\\Collections\\Order::DESC->value
@julienfastre asked if this would maybe cause problems see: #297 (comment)
I think we should replace with the ->value
call?
Thanks for reporting! Fix you suggest would be great ๐
Not sure its a good idea: as I remember, in issue #315, it was discussed that, maybe:
- we should not replace the "ASC" and "DESC" strings by constants in annotations,
- but we should keep the replacement where those string (or the previous constants) are in use as argument in
Criteria::orderBy
But any help for improving this is welcome ๐ธ
@julienfastre Would it fix this bug? ๐
I'll try to find some time next week or the week after, @TomasVotruba .
Regarding to this comment, do you think that we should remove all usage of Criteria::ASC
and Criteria::DESC
outside of a Criteria::orderBy
by the 'ASC'
and 'DESC'
string ?