[PR #10508] Fix id hash of entity with enum as identifier #12412

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

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

State: closed
Merged: Yes


Current situation
When an entity have a backed enum as identifier, Unit Of Work tries to cast to string when generating the hash of the id.

Error "Object of class MyEnum could not be converted to string"

Suggested fix
This PR fixes the problem by adding function to get id of entity with backed enum check.

Tests added
It seems tests for this feature were completely missing, so I added them.

Fixes https://github.com/doctrine/orm/issues/10471
Fixes https://github.com/doctrine/orm/issues/10334

**Original Pull Request:** https://github.com/doctrine/orm/pull/10508 **State:** closed **Merged:** Yes --- **Current situation** When an entity have a backed enum as identifier, Unit Of Work tries to cast to string when generating the hash of the id. `Error "Object of class MyEnum could not be converted to string"` **Suggested fix** This PR fixes the problem by adding function to get id of entity with backed enum check. **Tests added** It seems tests for this feature were completely missing, so I added them. Fixes https://github.com/doctrine/orm/issues/10471 Fixes https://github.com/doctrine/orm/issues/10334
admin added the pull-request label 2026-01-22 16:13:58 +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#12412