zendframework/zf2 — pull request #3803 by wryck7 (2013-02-17 03:41:02+00:00)
Title: Fix identical validator

These changes adds the possibility to use `Zend\Validator\Identical` to validate a form input that lives inside a fieldset:

See exemple below:

```PHP
use Zend\Form\Element;
use Zend\Form\Fieldset;
use Zend\Form\Form;
use Zend\InputFilter\Input;
use Zend\InputFilter\InputFilter;

$user = new Fieldset('user'); // (1)
$user->add(array(
'name' => 'email', // (2)
'type' => 'Zend\Form\Element\Email',
'attributes' => array(
'required' => 'required',
),
'options' => array(
'label' => 'Email',
),
));

$signUp = new Form('signUp');
$signUp->add($user);
$signUp->add(array(
'name' => 'confirmEmail', // (3)
'type', 'Zend\Form\Element\Email',
'options' => array(
'label' => 'Confirm your email',
),
));

$inputFilter = new InputFilter();
$inputFilter->add(array(
'name' => 'confirmEmail', // references (3)
'required' => true,
'validators' => array(
array(
'name' => 'Identical',
'options' => array(
// 'user' references 'user' fieldset (1), and 'email'
// references 'email' element inside 'user' fieldset (2)
'token' => array('user' => 'email'),
),
),
),
));

$signUp->setInputFilter($inputFilter);

$signUp->setData(array(
'user' => array(
'email' => 'josias@duarte.com',
),
'confirmEmail' => 'josias@duarte.com',
));

// Will return true because "user['email']" == "confirmEmail"
if ($signUp->isValid()) {
}
```