Issues

ZF-12195: Zend_Validate_Callback does not support validation context

Issue Type: Improvement Created: 2012-05-10T08:55:42.000+0000 Last Updated: 2012-05-10T10:53:55.000+0000 Status: Open Fix version(s): Reporter: Przemys?aw Wróbel (wrobel) Assignee: Thomas Weidner (thomas) Tags: - Zend_Validate

Related issues: Attachments:

Description

Some validators like Identical make use of validation context passed as a second parameter to isValid() method. Apparently Callback passes options as a second parameter. Sometimes when you write a validator just for one situation you do not want to subclass Zend_Validate_Abstract but use Callback and may need access to the context for rules dependent on another fields' values.

Comments

Posted by Przemys?aw Wróbel (wrobel) on 2012-05-10T10:07:48.000+0000

Oops it seems that it does support context since options are merged with $input and $context like this: $options = $this->getOptions(); $callback = $this->getCallback(); $args = func_get_args(); $options = array_merge($args, $options);

but the entry in User Guide is incorrect http://framework.zend.com/manual/en/… The example says: function myMethod($value, $option) but it realy should be function myMethod($value, $context, $option) or better myMethod($value, $context, $option1, $option2, ...)

Posted by Frank Brückner (frosch) on 2012-05-10T10:53:55.000+0000

Please have a look on the last code example for the callback validator in the docs.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts