Skip to content

[Live] Ignore problems with writing bad types for writable paths #788

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

Merged

Conversation

weaverryan
Copy link
Member

Q A
Bug fix? no
New feature? yes
Tickets None
License MIT

Found when building some components. The motivating use-case is where you have a writable property that starts null but the setter method does NOT allow null (this is common with entity properties and methods). When that null is rehydrated later, we attempt to call the setter with a null value, which explodes.

This makes for a better UX... though with a sprinkle of magic to make it happen. Without this, you would need to make your setter methods allow null (e.g. setName(?string $name)) just because the original property starts as null.

Cheers!

The motivating use-case is where you have a writable property that starts
null but the setter method does NOT allow null. When that null is rehydrated later,
we attempt to call the setter with a null value, which explodes.

This makes for a better UX... though with a sprinkle of magic to make it happen.
@weaverryan weaverryan merged commit cc414dc into symfony:2.x Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant