Description
Symfony version(s) affected: 4.1.4
Description
I have these 2 entities, Test and TestTest.
TestTest has 2 datetime fields, datetimeStart, and datetimeEnd, both @Assert\NotBlank()
and @Assert\DateTime()
TestTest has a ManyToOne relation to Test.
TestType sets testTests as a collection of TestTestType and TestTestType has datetimeStart, and datetimeEnd both as 'widget' => 'single_text', 'date_format' => 'yyyy-MM-dd HH:mm:ss',
If we go to test_new
(index redirects here) and submit the form without data we see that not blank works https://i.imgur.com/D8QZvCg.jpg
Reset the page, and set the datetimeStart (or end) to test
, and it shows correctly that the value is not valid https://i.imgur.com/YKmhilM.jpg
Reset again and set the datetimeStart to a
, m
, y
, x
whatever character and it gets transformed to a date and passes validation https://i.imgur.com/uo7VvbW.jpg
I don't think this is intended behaviour... What I need it to do is DateTimeValidator should check for the value (x
) in this example, and return an error that the format is not valid
How to reproduce
https://github.com/alex2005git/symfony_form_validator_datetime
Clone the repo, modify .env
with the DATABASE_URL and database name symfony_form_validator_datetime
and run composer initDB
to create the table and update the schema