Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Conversation

@weaverryan
Copy link
Member

QA
Branch?4.3
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#31796 (see#31796 (comment))
LicenseMIT
Doc PRnot needed

With auto-validation, if a class has a setter (e.g.setFoo()) but there is nofoo property, it still tries to add validation to that property, resulting in a:

Property "foo" does not exist in class "App\Entity\Bar

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!

@weaverryanweaverryanforce-pushed theno-auto-validation-on-non-existent-prop branch from4af9fa1 to89f72a1CompareJune 7, 2019 15:29
continue;
}

if (false ===property_exists($className,$property)) {
Copy link
MemberAuthor

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',
Copy link
MemberAuthor

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.

@nicolas-grekasnicolas-grekas added this to the4.3 milestoneJun 7, 2019
@weaverryanweaverryanforce-pushed theno-auto-validation-on-non-existent-prop branch from89f72a1 tob702598CompareJune 7, 2019 18:22
@nicolas-grekas
Copy link
Member

Thank you@weaverryan.

@nicolas-grekasnicolas-grekas merged commitb702598 intosymfony:4.3Jun 7, 2019
nicolas-grekas added a commit that referenced this pull requestJun 7, 2019
…-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
@weaverryanweaverryan deleted the no-auto-validation-on-non-existent-prop branchJune 7, 2019 18:28
@dunglas
Copy link
Member

Looks good to me! Thank you Ryan.

@fabpotfabpot mentioned this pull requestJun 26, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@xabbuhxabbuhxabbuh approved these changes

+1 more reviewer

@SimperfitSimperfitSimperfit approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.3

Development

Successfully merging this pull request may close these issues.

6 participants

@weaverryan@nicolas-grekas@dunglas@xabbuh@Simperfit@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp