public function addValidator(ValidatorInterface $validator)
    {
        foreach ((array) $validator->getGroups() as $group_name) {
            if (false === array_key_exists($group_name, $this->validators)) {
                $this->validators[$group_name] = array();
            }

            $this->validators[$group_name][] = $validator;
        }
    }
public function addValidator(ValidatorInterface $validator)
    {
        foreach ((array) $validator->getGroups() as $group_name) {
            if (false === array_key_exists($group_name, $this->validators)) {
                $this->validators[$group_name] = array();
            }

            $this->validators[$group_name][] = $validator;
        }
    }
public function addValidator ( ValidatorInterface $ validator ) { foreach ( ( array ) $ validator -> getGroups ( ) as $ group_name ) { if ( false === array_key_exists ( $ group_name , $ this -> validators ) ) { $ this -> validators [ $ group_name ] = array ( ) ; } $ this -> validators [ $ group_name ] [ ] = $ validator ; } }
Allows you to add validator.

@param ValidatorInterface $validator the validator we want to add
Allows you to add validator .