[PR #10342] Add Fully-Qualified class name in UnrecognizedField exception #12279

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

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

State: closed
Merged: Yes


Currently if we use a field that is not properly registered in our mapping, we end up with the following exception from the BasicEntityPersister:

Unrecognized field: {field}

As with a complete stack trace we may be able to dig enough to find the right mapping, it can take more time to find the concerned entity in a context with less informations, such as logs.

This PR adds the entity FQCN to the exception message to ease debugging in such cases, using the class metadata available in BasicEntityPersister::class property. We end up with:

Unrecognized field: {fqcn}::{field}

As I didn't encountered any tests for the existing UnrecognizedException class behavior, I didn't add some but I can if needed.

**Original Pull Request:** https://github.com/doctrine/orm/pull/10342 **State:** closed **Merged:** Yes --- Currently if we use a field that is not properly registered in our mapping, we end up with the following exception from the `BasicEntityPersister`: ``` Unrecognized field: {field} ``` As with a complete stack trace we may be able to dig enough to find the right mapping, it can take more time to find the concerned entity in a context with less informations, such as logs. This PR adds the entity FQCN to the exception message to ease debugging in such cases, using the class metadata available in `BasicEntityPersister::class` property. We end up with: ``` Unrecognized field: {fqcn}::{field} ``` As I didn't encountered any tests for the existing `UnrecognizedException` class behavior, I didn't add some but I can if needed.
admin added the pull-request label 2026-01-22 16:13:33 +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#12279