ZF2-299: Callback Validator second arg is array of the form fields
Description
Component: Zend\Validator\Callback
This is the inputFilter:
$this->add($factory->createInput(array(
'name' => 'username',
'required' => true,
'filters' => array(
array(
'name' => 'StripTags',
),
),
'validators' => array(
array(
'name' => 'Callback',
'options' => array(
'callback' => array($model, 'userNameAvilable'),
'callbackOptions' => array('value I need'),
'messages' => array(
'callbackValue' => "This username is already taken",
),
),
),
),
)));
If I dump Zend\Validator\Callback at Line 144 var_dump(array_merge($args, $options)); die();
I get
array(3) {
[0]=>
string(17) "invented_username"
[1]=>
array(7) {
["username"]=>
string(17) "invented_username"
["password"]=>
string(0) ""
["email"]=>
string(0) ""
["fname"]=>
string(0) ""
["lname"]=>
string(0) ""
["role"]=>
string(7) "student"
["Send"]=>
string(4) "Send"
}
[2]=>
string(12) "value I need"
}
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2012-05-14T14:43:45.000+0000
In looking at this, I think that the $context should be passed as an array as the value immediately following $value, before any other callback options. I've done this here: https://github.com/weierophinney/zf2/…