-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[DoctrineBridge] DoctrineLoader can't access embedded object properties #31775
Comments
Same problem here. My entity
First property in embeddable generates
Updated to Symfony 4.3 hour ago. |
Shouldn’t it be fixed in the Doctrine loader directly? Simply skipping Embedebbables in the parent class should be enough, and won’t prevent auto-validation to work because metadata are still stored in the child class (to be verified). I don’t have a computer this weekend, but I’ll try to work on a fix on Monday. |
I found the root cause. Working on a fix. |
see #31811 |
… class metadata (xabbuh) This PR was merged into the 4.3 branch. Discussion ---------- [DoctrineBridge] don't add embedded properties to wrapping class metadata | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #31775 | License | MIT | Doc PR | Commits ------- 56fe025 don't add embedded properties to wrapping class metadata
With nested embedded objects it's still the same problem. |
@martiis Can you open a new issue and provide a small example application that allows to reproduce? |
sure, but in about 1-2 hours, commuting :) |
Symfony version(s) affected: 4.3.0
Description
I just upgraded my application to 4.3.0 and saw this bug.
We have a
UserAddress
entity:with an embedded object
Address
:With new Doctrine auto-validation feature, it tries to access
address.firstName
property, but in https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php#L39, we check if given property exists as it's given, so it can't work.Possible Solution
Use
symfony/property-accessor
? Instead of reflection metadata which does not contains embedded objects metadata.The text was updated successfully, but these errors were encountered: