public function setValidator(string $validator_class_name, array $constraints = []) : self
    {
        $this->validator = $validator_class_name;
        $this->constraints = $constraints;
        return $this;
    }
public function setValidator(string $validator_class_name, array $constraints = []) : self
    {
        $this->validator = $validator_class_name;
        $this->constraints = $constraints;
        return $this;
    }
public function setValidator ( string $ validator_class_name , array $ constraints = [ ] ) : self { $ this -> validator = $ validator_class_name ; $ this -> constraints = $ constraints ; return $ this ; }
Sets a validator for the field

@param string $validator_class_name The name of the validation class
@param array $constraints Optional constraints

@return self
Sets a validator for the field