Disable notInArray Validator Zend Framework 2

user1686230 picture user1686230 · Nov 1, 2012 · Viewed 9.8k times · Source

Is there a way to disable notInArray Validator in Zend Framework 2. All the info on the internet shows how to disable the notInArray Validator in Zend Framework 1, for example in this fashion

If you do not want the InArray validator at all, you can disable this behavior by either calling setRegisterInArrayValidator(false) on the element, or by passing false to the registerInArrayValidator configuration key on element creation.

One the posts in stackoverflow can be found here

Unfortunately this is not possible in Zend Framework 2. So in case if anybody has a tip how this can be disabled.

Answer

tarkhov picture tarkhov · May 13, 2013

Since version 2.2, Zend Framework provide the ability to disable inArray validator calling:

$element->setDisableInArrayValidator(false);

or passing option to an element:

'disable_inarray_validator' => false