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

Missing validations for date range type #3

Open
johnkrovitch opened this issue Nov 25, 2019 · 2 comments
Open

Missing validations for date range type #3

johnkrovitch opened this issue Nov 25, 2019 · 2 comments

Comments

@johnkrovitch
Copy link

When using the date range form type, if we fill only the start date and leave the endDate empty, an exception is thrown.

A validator should be applied to return a form error and the bundle should not throw exception for a missing field.

@johnkrovitch
Copy link
Author

The error is present event if the two fields are filled :

"Cannot read index "startDate" while trying to traverse path "[startDate]". Available indices are "Array
(
)
".

@johnkrovitch
Copy link
Author

It is missing a transform like :

 ->addModelTransformer(new CallbackTransformer(function ($value) {
                if (null === $value) {
                    $value = [
                        'startDate' => null,
                        'endDate' => null,
                    ];
                }
                
                return $value;
            }, function ($value) {
                
                return $value;
            }))

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

No branches or pull requests

1 participant