-
-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DoctrineObjectConstructor fails loading entity when deserializing XML #1286
Comments
Hmm, that makes sense. Can you create a pull request with a suggested fix (and a test possibly..)? |
Yes, I can submit a merge request. But now I re-think this solution: is this the right way to solve the problem? Shouldn't $data always be an array (maybe even forced to be an array in the function definition)? Isn't the actual bug in the parser that should return an array instead of an SimpleXmlElement? |
Fix for issue #1286: loading fails when deserializing XML
fixed by #1289 |
When you deserialize XML, the DoctrineObjectConstructor does not retrieve the values in the correct way, causing all values to be NULL, so loading the Doctrine entity fails.
In version 3.11.0 on line 110 of DoctrineObjectConstructor is says:
$identifierList[$name] = $data[$propertyMetadata->serializedName];
But when deserializing XML, $data is not an array; its a SimpleXMLElement. In this case, the value should be retrieved like
$identifierList[$name] = (string)$data->{$propertyMetadata->serializedName}
Suggested fix
Steps required to reproduce the problem
Expected Result
Actual Result
The text was updated successfully, but these errors were encountered: