Hi,

another question just popped up. When I have an input filter element, I
can get the validator chain to get all validators like this:

    $form->getInputFilter()->get('nickname')
         ->getValidatorChain()->getValidators();

Unfortunalety, this is just a numbered array. If I want to pick one of
the validators to amend it, I need to loop through all of them and check
for the validator class to find the one I want. I just want to add the
exclude option to an Db\NoRecordExists validator on the fly.

I also tried to give the validator elements in the array a name, which
worked in ZF1 IIRC:

-------------------------------------------------------
    'validators' => array(
        'stringLength' => array(
            'name'    => 'StringLength',
            'options' => array(
                'encoding' => 'UTF-8',
                'min'      => 1,
                'max'      => 32,
            ),
        ),
        'dbNoRecordExists' => array(
            'name'    => 'Db\NoRecordExists',
            'options' => array(
                'table'     => 'users',
                'field'     => 'nickname',
                'adapter'   => $this->adapter,
            ),
        ),
    ),
-------------------------------------------------------

But still the StringLength validator has the array key 0 and
Db\NoRecordExists has the 1.

Has anyone an idea how to solve this without accessing via the numbered
keys which could change when I add more validators?

Regards,

Ralf

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to