[PR #1179] Fix embeddables class metadata (work-in-progress) #9240

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

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

State: closed
Merged: No


ClassMetadataInfo is returning more than one result in getFieldNames() for the embeddables properties. This method is used by DoctrineModule\Stdlib\Hydrator\DoctrineObject in the extraction process.

Since its returning a number of results equal the number of properties of the embedded object, it will never find the correct setter for the extraction and that causes that property to be removed from the extracted array.

I was able to solve the issue by hacking into the getFieldNames() for testing and merging the duplicated entries, and then the object was successfully extracted.

By digging into the code, i found out that there is a mapEmbedded(), but instead of using that for embeddeds, its using the default mapField, which may be the root cause of the problem.

  • Hack into the getFieldNames() method to see if the expected solution would work
  • Remove multiple class declaration in the same file from the files i'll work with
  • Create a failing testcase
  • Create a solution
**Original Pull Request:** https://github.com/doctrine/orm/pull/1179 **State:** closed **Merged:** No --- ClassMetadataInfo is returning more than one result in getFieldNames() for the embeddables properties. This method is used by DoctrineModule\Stdlib\Hydrator\DoctrineObject in the extraction process. Since its returning a number of results equal the number of properties of the embedded object, it will never find the correct setter for the extraction and that causes that property to be removed from the extracted array. I was able to solve the issue by hacking into the getFieldNames() for testing and merging the duplicated entries, and then the object was successfully extracted. By digging into the code, i found out that there is a mapEmbedded(), but instead of using that for embeddeds, its using the default mapField, which may be the root cause of the problem. - [x] Hack into the getFieldNames() method to see if the expected solution would work - [x] Remove multiple class declaration in the same file from the files i'll work with - [x] Create a failing testcase - [ ] Create a solution
admin added the pull-request label 2026-01-22 16:03:40 +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#9240