[PR #6546] Fix OrderBy annotation with association #10023

Open
opened 2026-01-22 16:06:10 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/6546

State: closed
Merged: No


According to SchemaValidator, the @OrderBy annotation can have either a field name or an association name.

However if association is used it doesn't work correctly and the result is an Undefined index error in DefaultQuoteStrategy::getColumnName() - obviously since the association is not in $classMetadata->fieldMappings.

Of course some test is needed. But first I'd like to know how (if at all) to handle associations with more than one join column.

**Original Pull Request:** https://github.com/doctrine/orm/pull/6546 **State:** closed **Merged:** No --- According to SchemaValidator, the `@OrderBy` annotation can have either [a field name or an association name](https://github.com/doctrine/doctrine2/blob/43009682a49c9fa7fe1bacabf22a7230aa524e1f/lib/Doctrine/ORM/Tools/SchemaValidator.php#L231). However if association is used it doesn't work correctly and the result is an `Undefined index` error in `DefaultQuoteStrategy::getColumnName()` - obviously since the association is not in `$classMetadata->fieldMappings`. Of course some test is needed. But first I'd like to know how (if at all) to handle associations with more than one join column.
admin added the pull-request label 2026-01-22 16:06:10 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#10023