Comments (10)
A fallback_if_invalid
setting would fix this. If it defaulted to true
there would be no BC break. It would also be pretty easy to implement.
from zend-inputfilter.
It would also be pretty easy to implement.
Considering the dozens of hours spent with the most recent releases to build a test matrix for the current combination of options, I beg to differ. Any new options introduced at this point need to be very carefully evaluated, as they add more permutations to the test matrix: we already are testing something like 32 combinations of options; adding another would double that to 64.
from zend-inputfilter.
Considering the dozens of hours spent with the most recent releases to build a test matrix for the current combination of options, I beg to differ. Any new options introduced at this point need to be very carefully evaluated, as they add more permutations to the test matrix: we already are testing something like 32 combinations of options; adding another would double that to 64.
In that case, maybe we could remove the "fallback if invalid" behaviour in 3.0?
from zend-inputfilter.
I think the name is not correct for this behavior I am thinking about default_value
or something this should be used only if value not set, otherwise should be used fallback if set. this also would solve BC problem but also have big test matrix problem. But well if this is good feature and we want it in 3.0 we can do it now and remove whole test matrix in 3.0 when other options will be removed.
from zend-inputfilter.
The behavior can be do with very little effort by extending Input
with your custom class.
Personally I prefer don't add implementations are not required by the Input interface and just provide stable and tested implementations.
Anyway, feel free to send a PR with the desired implementation and I'll reconsider my opinion if the implementation is simple and bugfree
Hint:
zend-inputfilter/test/InputTest.php
Lines 581 to 587 in a05fa0b
zend-inputfilter/test/BaseInputFilterTest.php
Lines 473 to 506 in a05fa0b
from zend-inputfilter.
@Maks3w what do you think if we make this default behavior in ZF3?
I think it is more logical to add fallback(default value) if value isn't set, but not when value is invalid(I would want error here). Or support both, but maybe that would be to complicated.
This would be BC but for 3.0 this is acceptable.
from zend-inputfilter.
@svycka +1 I use same behavior especially in grid controllers
from zend-inputfilter.
@svycka I don't consider replace a behavior an option. Instead I suggest send a PR where two behaviors could be used (one at time) probably setting a second parameter to setFallbackValue with an optional second argument where the default value is the current behavior.
from zend-inputfilter.
Closed due inactivity
from zend-inputfilter.
Ran into this limitation today made me pull my hair out. Fallback values which just work in the empty case would be very much appreciated.
W.r.t. complexity in the combination of flags: I think the solution is to split the Input class to multiple classes. Some combinations of options don't make sense or are very niche and you avoid that entirely that way.
from zend-inputfilter.
Related Issues (20)
- Class Zend\ServiceManager\AbstractPluginManager not found HOT 5
- Avoiding the default NotEmpty::IS_EMPTY validation message. HOT 3
- CollectionInputFilter throws exception on scalar input HOT 3
- ConfigProvider - registration of InputFilterAbstractServiceFactory HOT 1
- Value is required message for optional field HOT 8
- [php 7.2] incompatible prototype HOT 2
- InputFilter::getValues() does not throw like it should HOT 2
- Intended behaviour on nested input filters and empty POST data? HOT 2
- FileInput not compatible with PSR (and Dictatoros) UploadedFile HOT 3
- How use Callback validator when field is conditionally required? HOT 3
- Duplicate error messages for collection input field items HOT 14
- Version 2.8.5 broke backward compatibility for apigility HOT 4
- Null value for inputfilter causes exception HOT 28
- Add support for required flag to input filters HOT 2
- collectionRawValues not populated in setData of CollectionInputFilter HOT 15
- MVC InputFilterPluginManager missing InputFilterAbstractFactory config HOT 15
- Input filter specification and merging HOT 1
- Exception when supplying non-array data to an ArrayInput HOT 2
- Empty validation message for file input when sent array for file input HOT 3
- Fatal error: Class 'Zend\ServiceManager\AbstractPluginManager' not found in D:\XAMPP\htdocs\sn\zend-mail\vendor\zendframework\zend-mail\src\Protocol\SmtpPluginManager.php on line 20 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zend-inputfilter.