Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
PropertyInfoLoader should not try to add validation to non-existent property#31936
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
PropertyInfoLoader should not try to add validation to non-existent property#31936
Uh oh!
There was an error while loading.Please reload this page.
Conversation
4af9fa1 to89f72a1Compare| continue; | ||
| } | ||
| if (false ===property_exists($className,$property)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
property_exists() is what is used inPropertyMetadata, which triggered the exception. This matches that.
| 'alreadyMappedNotBlank', | ||
| 'alreadyPartiallyMappedCollection', | ||
| 'readOnly', | ||
| 'nonExistentField', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
No asserts were added, but, without the fix, these changes are enough to trigger an exception to be thrown while running this test.
89f72a1 tob702598Comparenicolas-grekas commentedJun 7, 2019
Thank you@weaverryan. |
…-existent property (weaverryan)This PR was merged into the 4.3 branch.Discussion----------PropertyInfoLoader should not try to add validation to non-existent property| Q | A| ------------- | ---| Branch? | 4.3| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#31796 (see#31796 (comment))| License | MIT| Doc PR | not neededWith auto-validation, if a class has a setter (e.g. `setFoo()`) but there is no `foo` property, it still tries to add validation to that property, resulting in a:> Property "foo" does not exist in class "App\Entity\BarThis fixes that. I believe it's "just this simple", but I don't have any experience with the code in this area yet.Cheers!Commits-------b702598 Fixing bug where PropertyInfoLoader tried to add validation to non-existent properties
dunglas commentedJun 8, 2019
Looks good to me! Thank you Ryan. |
With auto-validation, if a class has a setter (e.g.
setFoo()) but there is nofooproperty, it still tries to add validation to that property, resulting in a:This fixes that. I believe it's "just this simple", but I don't have any experience with the code in this area yet.
Cheers!