I create a custom date Validator. But I keep getting this error message :
"Zend\\Validator\\ValidatorPluginManager::get was unable to fetch or create an instance for date_validator"
I did some research and tried adding in module.config.php after the view manager array.
'validators' => array(
'invokables' => array(
'date_validator' => 'Administrativo\InputFilter\Date_Validator'
),
),
What am I missing here?
Your configuration seems okay.
Are you sure you have a file (invokable class) with the name Date_Validator
in a folder Administrativo\\InputFilter
in your module?
Is the namespace inside this class Administrativo\\InputFilter
and is the class name Date_Validator
.
It is important that both the class name and namespace have to be correct as well as the folder names and file name . Otherwise the PluginManager will not be able to find your file.
If all that is fine then there is something else you should check.
If you build your input filters through config array then you should make sure that the factory inside your InputFilter
class holds a correctly populated InputFilterPluginManager
instance (with both ValidatorManager
and FilterManager
on board). Otherwise it will not inject those classes in the setInputFilterManager
method and it will later create a new empty plugin manager instance which will obviously not hold your validator class.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.