"Zend\I18n\Validator\Alpha"; class does not exist

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

"Zend\I18n\Validator\Alpha"; class does not exist

Philip G
Zend\I18n Namespace  does not exist in a fresh install of Zend\Validator.

Brand new install of Zend\Validator, Zend\FilterInput, and I get this
attempting to create a new instance of Alpha using ->createInputFilter
against Zend\InputFilter\Factory.

composer.json:
    "require": {
        "zendframework/zend-validator": "~2.4",
        "zendframework/zend-inputfilter": "~2.4",
        "zendframework/zend-servicemanager": "~2.4"
    }

Code:
    $factory = new Factory();
    $inputFilter = $factory->createInputFilter([
        'First Name' =>
            array(
                'name' => 'First Name',
                'validators' =>
                    array(
                        0 =>
                            array(
                                'name' => 'alpha',
                                'options' =>
                                    array(
                                        'allowWhiteSpace' => true,
                                    ),
                            ),
                    ),
            ),
    ]);

I get an exception:
( ! ) Zend\ServiceManager\Exception\ServiceNotFoundException:
Zend\Validator\ValidatorPluginManager::createFromInvokable: failed
retrieving "alpha(alias: alpha)" via invokable class
"Zend\I18n\Validator\Alpha"; class does not exist in
/var/svn-root/trunk/campaigns/application/vendor/zendframework/zend-servicemanager/AbstractPluginManager.php
on line 195

Used sample code from:
http://framework.zend.com/manual/current/en/modules/zend.input-filter.intro.html
Reply | Threaded
Open this post in threaded view
|

Re: "Zend\I18n\Validator\Alpha"; class does not exist

Bas Kamer
AlphaValidator is in the i18n package. Run composer.phar require "zendframework/zend-i18n" and your the dependency should be resolved.

Bas




> Op 7 apr. 2015 om 20:18 heeft Philip G <[hidden email]> het volgende geschreven:
>
> Zend\I18n Namespace  does not exist in a fresh install of Zend\Validator.
>
> Brand new install of Zend\Validator, Zend\FilterInput, and I get this
> attempting to create a new instance of Alpha using ->createInputFilter
> against Zend\InputFilter\Factory.
>
> composer.json:
>    "require": {
>        "zendframework/zend-validator": "~2.4",
>        "zendframework/zend-inputfilter": "~2.4",
>        "zendframework/zend-servicemanager": "~2.4"
>    }
>
> Code:
>    $factory = new Factory();
>    $inputFilter = $factory->createInputFilter([
>        'First Name' =>
>            array(
>                'name' => 'First Name',
>                'validators' =>
>                    array(
>                        0 =>
>                            array(
>                                'name' => 'alpha',
>                                'options' =>
>                                    array(
>                                        'allowWhiteSpace' => true,
>                                    ),
>                            ),
>                    ),
>            ),
>    ]);
>
> I get an exception:
> ( ! ) Zend\ServiceManager\Exception\ServiceNotFoundException:
> Zend\Validator\ValidatorPluginManager::createFromInvokable: failed
> retrieving "alpha(alias: alpha)" via invokable class
> "Zend\I18n\Validator\Alpha"; class does not exist in
> /var/svn-root/trunk/campaigns/application/vendor/zendframework/zend-servicemanager/AbstractPluginManager.php
> on line 195
>
> Used sample code from:
> http://framework.zend.com/manual/current/en/modules/zend.input-filter.intro.html