DDC-3383: [GH-1179] Fix embeddables class metadata (work-in-progress) #4179

Closed
opened 2026-01-22 14:36:48 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Nov 10, 2014).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user @doctrinebot:

This issue is created automatically through a Github pull request on behalf of fabiocarneiro:

Url: https://github.com/doctrine/doctrine2/pull/1179

Message:

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
Originally created by @doctrinebot on GitHub (Nov 10, 2014). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user @doctrinebot: This issue is created automatically through a Github pull request on behalf of fabiocarneiro: Url: https://github.com/doctrine/doctrine2/pull/1179 Message: 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 Bug label 2026-01-22 14:36:48 +01:00
admin closed this issue 2026-01-22 14:36:48 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jan 24, 2015):

Comment created by @doctrinebot:

A related Github Pull-Request [GH-1179] was labeled:
https://github.com/doctrine/doctrine2/pull/1179

@doctrinebot commented on GitHub (Jan 24, 2015): Comment created by @doctrinebot: A related Github Pull-Request [GH-1179] was labeled: https://github.com/doctrine/doctrine2/pull/1179
Author
Owner

@doctrinebot commented on GitHub (Jan 24, 2015):

Comment created by @doctrinebot:

A related Github Pull-Request [GH-1179] was labeled:
https://github.com/doctrine/doctrine2/pull/1179

@doctrinebot commented on GitHub (Jan 24, 2015): Comment created by @doctrinebot: A related Github Pull-Request [GH-1179] was labeled: https://github.com/doctrine/doctrine2/pull/1179
Author
Owner

@doctrinebot commented on GitHub (May 22, 2015):

Comment created by @doctrinebot:

A related Github Pull-Request [GH-1179] was closed:
https://github.com/doctrine/doctrine2/pull/1179

@doctrinebot commented on GitHub (May 22, 2015): Comment created by @doctrinebot: A related Github Pull-Request [GH-1179] was closed: https://github.com/doctrine/doctrine2/pull/1179
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#4179