-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
A DateTime filter #1
Comments
@gscscnd https://github.com/zendframework/zend-filter/blob/master/src/DateTimeFormatter.php Originally posted by @froschdesign at zendframework/zend-filter#85 (comment) |
@froschdesign, it seems that Originally posted by @gszy at zendframework/zend-filter#85 (comment) |
@gscscnd The following filtering is support:
Is this correct or did I forget something? Originally posted by @froschdesign at zendframework/zend-filter#85 (comment) |
Actually I don’t check if a
Also Originally posted by @gszy at zendframework/zend-filter#85 (comment) |
We have to explicitly define all possible values for the filtering - input and ouput. Otherwise, we can not write the full documentation and all required unit tests.
This means:
Originally posted by @froschdesign at zendframework/zend-filter#85 (comment) |
We can throw an Anyway:
Originally posted by @gszy at zendframework/zend-filter#85 (comment) |
@gscscnd
No exceptions are allowed during the process of filtering. If the given value can not be handled by the filter, the value should be returned unfiltered.
Does the filter create a new object each time or will the same object returned? Can you describe the typical use case for this filter? Thanks! Originally posted by @froschdesign at zendframework/zend-filter#85 (comment) |
🆗, will fix that. (Current code doesn’t throw exceptions explicitly, but setting
Returns the same instance.
I’ve got a form (or any array of data, for that matter) with a datetime‑like input and an entity with a datetime‑like property. I setup an InputFilter with a Date validator and a DateTime filter. The input array contains Originally posted by @gszy at zendframework/zend-filter#85 (comment) |
@gscscnd
If you use zend-hydrator already then you can use Originally posted by @froschdesign at zendframework/zend-filter#85 (comment) |
Well, I didn’t know about it. Thanks for the pointer! Originally posted by @gszy at zendframework/zend-filter#85 (comment) |
This is a new filter that returns
DateTime
or (if desired)DateTimeImmutable
instances.Originally posted by @gszy at zendframework/zend-filter#85
The text was updated successfully, but these errors were encountered: