-
-
Notifications
You must be signed in to change notification settings - Fork 409
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 wrong setter for non nullable fields #198
Comments
Hmm, I was very careful about these details, but indeed, I can’t think of why I would have done this intentionally. Looks like a bug - thanks for the report :) |
Are you sure this is a bug? This would allow to use validations, otherwise the failure occurs too early. |
Hmm, interesting. Are you using the form submit, and it’s submitting the values as null? |
No, not using form submit. "Legacy" code, build with older Symfony releases. Manual validations with Symfony validation/constraint classes. Anyway it should be selectable (by argument to console command) if you want very strict definitions (nulls not allowed if And I really prefer handling nulls with validations and not manually modifying |
Looking at older ( |
Even if this is correct in theory ... I'm afraid that in practice, when using Symfony Forms, is not correct. You must make everything nullable or the app won't work. That's why we did that in the Symfony Demo app for example: https://github.com/symfony/demo/blob/master/src/Entity/Post.php |
Hi!
It's a minor syntax mistake, but right now generated setters allow to pass the null value to non nullable fields, if they are ManyToOne relationship.
The arg should be
AnotherEntity
not?AnotherEntity
Cheers!
The text was updated successfully, but these errors were encountered: