You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ObjectRepository::findBy orderBy should accept SortDirection #523
On v4, it should accept it, and on v5, it must accept it, and no longer needs to accept strings. Requiring that every implementation suddenly accept it would be a breaking change. Not sure what to do on 4.x. @derrabus@SenseException@stof@GromNaN thoughts? Maybe an @method annotation would help on 4.x? Also, requiring a polyfill just for a phpdoc comment feels weird.
Widening parameter type is a BC break for implementers (as implementers are not allowed to use a more restrictive type based on the Liskov Substitution Principle).
Two PRs were opened to allow SortDirection values wherever sort directions are accepted:
Allow SortDirection in EntityRepository::findBy() and findOneBy() orm#12613: EntityRepository::findBy() and findOneBy() now accept and document SortDirection, while strings remain non-deprecated, since the ObjectRepository interface of persistence 3.x and 4.x still documents strings as the only statically valid values.
Activity
greg0ire commentedon Sep 10, 2026
On v4, it should accept it, and on v5, it must accept it, and no longer needs to accept strings. Requiring that every implementation suddenly accept it would be a breaking change. Not sure what to do on 4.x. @derrabus @SenseException @stof @GromNaN thoughts? Maybe an
@methodannotation would help on 4.x? Also, requiring a polyfill just for a phpdoc comment feels weird.Allow SortDirection enum in ObjectRepository::findBy()
Allow SortDirection enum in ObjectRepository::findBy()
Allow SortDirection enum in ObjectRepository::findBy()
Allow SortDirection enum in ObjectRepository::findBy()
GromNaN commentedon Sep 11, 2026
Thanks @dmitryuk for reporting this issue. The new enum will be added in 5.0.0 by #525.
dmitryuk commentedon Sep 11, 2026
What about v4?
GromNaN commentedon Sep 11, 2026
See #524 (comment)
GromNaN commentedon Sep 13, 2026
Two PRs were opened to allow
SortDirectionvalues wherever sort directions are accepted:SortDirectioninEntityRepository::findBy()andfindOneBy()orm#12613:EntityRepository::findBy()andfindOneBy()now accept and documentSortDirection, while strings remain non-deprecated, since theObjectRepositoryinterface of persistence 3.x and 4.x still documents strings as the only statically valid values.SortDirectionsupport to query and aggregation sort orders mongodb-odm#3048: appliesSortDirectionto the document repositoryfindBy()/findOneBy()and to the query builder, expression and aggregation sort orders.