-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Description
Bug Report
| Q | A |
|---|---|
| BC Break | yes/no |
| Version | 2.17.2 |
Summary
I have a relationship between Threads and Messages. One thread can contain many Messages. Using XML mapping there is an orderBy entry stating the collection of messages should be ordered by their created at date. This works correctly on v2.16.3 but open upgrading to 2.17.2 this is no longer respected and the collection of messages is ordered by it's UUID.
Current behavior
orderBy entry not being respected and instead sorting the collection by UUID
How to reproduce
Use QueryBuilder to get a collection of Threads.
<entity repository-class="App\ThreadRepository" name="App\Thread" table="threads">
<one-to-many field="messages" target-entity="App\Message" mapped-by="thread" fetch="EAGER">
<order-by>
<order-by-field name="createdAt"/>
</order-by>
</one-to-many>
</entity>
<entity repository-class="App\MessageRepository" name="App\Message" table="messages">
<field name="createdAt" type="datetime" column="created_at"/>
<many-to-one field="thread" target-entity="App\Thread" inversed-by="messages"/>
</entity>
$qb = $this->getEntityManager()->createQueryBuilder();
$qb
->select('thread')
->from(Thread::class, 'thread');
return $qb->getQuery()->getResult();
Expected behavior
orderBy entry to be respected and order the collection by the stated field.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels