-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Form] Explain deprecation of @Assert\Date
on DateTimeInterface
fields
#13998
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
At the top of the linked page we have this paragraph:
What would be your suggestion to make things even more clear? |
I think there should be a "New in Version 4.2"-box explaining what the deprecation message says: Do not use this on an entity with But this immediately leads to the next question: What's the recommended way to show a nice error message to the users if they submit BTW: "follows a valid YYYY-MM-DD format." in your linked paragraph is ambiguous about what it does exactly: Just check that the submitted data follows this format (like |
As you are probably using a No exception, as the form field ensures that the type is valid (if you configure it accordingly). |
Thanks to @apfelbox, I'm now suggesting for the box:
Should I come up with a PR? This message should be shown on all applicable pages ( BTW: Completely off-topic: In the first list (table of contents) on https://symfony.com/doc/current/reference/forms/types/datetime.html why are some items black and some blue? |
On one hand, it seems excessive to show that everywhere, on the other hand I have the feeling that @javiereguiluz we need your wisdom / input here (or any of the other docs members 😄 ). |
I am not convinced that adding this is really necessary. In general, adding more text often leads to people not reading everything. And if you are using the constraint with |
Well, not about |
Sorry to dig up an old subject, but it is not clear for me and I need a confrimation. By
you mean something like this right?
|
Thank you for this issue. |
Could I get an answer? If I do not hear anything I will assume this issue is resolved or abandoned. Please get back to me <3 |
Hey, I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen! |
symfony/symfony#25015 gives this deprecation note:
This fact should be explained at the corresponding Constraint pages, e.g. https://symfony.com/doc/current/reference/constraints/Date.html
Question: If you just rely on the
?\DateTimeInterface
type-hint of the setter, and the user submits an invalid date in a form, how can you show a nice error message? What's the best practice here?The text was updated successfully, but these errors were encountered: