-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
PropertyAccessor::writeProperty() throws misleading NoSuchPropertyException #24742
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
Comments
Can you be a bit more specific of what you would have liked to have instead? I am not sure if I completely got that. |
@xabbuh, essentially, I envision the exception appending the value of
So, the line of code might look like: (formatted for readability)
|
Would you like to open a pull request with your suggestion? |
…yException Message (Simperfit) This PR was merged into the 4.1-dev branch. Discussion ---------- [PropertyAccess] add more information to NoSuchPropertyException Message | Q | A | ------------- | --- | Branch? | 4.1 | Bug fix? | no | New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | no | Fixed tickets | #24742 | License | MIT | Doc PR | Add more context to NoSuchPropertyException as discussed in the issue. Commits ------- dee00f8 [PropertyAccess] add more information to NoSuchPropertyException Message
I had (incorrectly) architected myself into a situation where I have an entity without a setter for a property, and when trying to hydrate the entity from a FormType, I would get the following exception:
I'm not always a smart man, so it wasn't immediately obvious what that message meant. It took me dumping the contents of the
$access
array before it clicked:Long story short: I believe the NoSuchPropertyException that is thrown should include the
$access[self::ACCESS_NAME]
if it exists.Thank you!
The text was updated successfully, but these errors were encountered: