Skip to content
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

[make:entity] don't set array field default value for nullable column #1293

Merged
merged 1 commit into from
Jul 10, 2023

Conversation

Rootie
Copy link
Contributor

@Rootie Rootie commented Mar 15, 2023

Setting a default value will lead to a wrong (not nullable) return value of the getter method.

Also setting a default value on a nullable field somehow cancels out the intention of nullable (except for setting it explicitly).

I'm not sure if this should be treated as a bc break. but since no existing properties are overwritten i think it should be fine.

@Rootie Rootie changed the title [make:entity] don't set default value for array field when column is nullable [make:entity] don't set array field default value for nullable column Mar 15, 2023
@sadikoff
Copy link
Contributor

Hi @Rootie,

Can you please update the description and PR so it can be reviewed?

Cheers!

@Rootie
Copy link
Contributor Author

Rootie commented Jun 27, 2023

Hi @sadikoff,

i updated the description.

I also wanted to note that if keeping the default value for array fields is wanted, then it is also possible to just modify the addGetter call in Util\ClassSourceManipulator::addEntityField

@weaverryan
Copy link
Member

This makes sense to me. Could you rebase so we can check the tests?

@Rootie
Copy link
Contributor Author

Rootie commented Jun 28, 2023

Hi @weaverryan,

i updated my branch

@weaverryan
Copy link
Member

Thanks @Rootie!

@weaverryan weaverryan merged commit c01ac62 into symfony:main Jul 10, 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.

3 participants