-
-
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 calls Doctrine with null identifier columns #1297
Comments
I wrote a pull request. I'm not sure it will work properly with multiple ids where a single id is null, but it would require an integration with a real database to check this. |
Thanks @Toilal the way you constructed the |
Yes, that's exactly what I mean but I don't know if Doctrine actually accept some undefined values among declared composed ids. |
i have the same concern. can anyone try it please? @VincentLanglet out of curiosity, how does it look your xml or json? |
I think you wanted to tag @Vincentv92, @goetas ? |
Steps required to reproduce the problem
@ORM\Id
notationExpected Result
This seems related on changes in the following PR's:
#1224
#1253
The issue lies in
DoctrineObjectConstructor
whereby the call to the entity manager is malformed:$entityManager->find("App\Entity\Order", [ 'ordernumber' => null ], $lockMode, $lockVersion)
Whereby
ordernumber
cannot be null, since this is the identifying column as defined by Doctrine schemaserializer/src/Construction/DoctrineObjectConstructor.php
Line 104 in 92698b2
I believe there is elseif missing, because we are deserializing from an SimpleXMLElement the property exists, but cannot be accessed by
$data[$propertyMetadata->serializedName]
which will return in a null value, which causes the incorrect call to Doctrine find.So this can be changed to
(string) $data->{$data[$propertyMetadata->serializedName]};
if it's an SimpleXMLElement but thats not really nice looking.When adding this to the elseif on line 108:
It works as expected, but I can't figure out if this causes more issues or should be approached different.
Actual Result
The text was updated successfully, but these errors were encountered: