original_string: public function setValidator($name, Validator $validator)
      {
          $validator->setProvider(self::VALIDATOR_PROVIDER_NAME, $this);
          $this->_validators[$name] = $validator;
  
          return $this;
      }
code: public function setValidator($name, Validator $validator)
      {
          $validator->setProvider(self::VALIDATOR_PROVIDER_NAME, $this);
          $this->_validators[$name] = $validator;
  
          return $this;
      }
code_tokens: public function setValidator ( $ name , Validator $ validator ) { $ validator -> setProvider ( self :: VALIDATOR_PROVIDER_NAME , $ this ) ; $ this -> _validators [ $ name ] = $ validator ; return $ this ; }
docstring: This method stores a custom validator under the given name.
  
  You can build the object by yourself and store it in your object:
  
  ```
  $validator = new \Cake\Validation\Validator($table);
  $validator
  ->add('email', 'valid-email', ['rule' => 'email'])
  ->add('password', 'valid', ['rule' => 'notBlank'])
  ->allowEmpty('bio');
  $this->setValidator('forSubscription', $validator);
  ```
  
  @param string $name The name of a validator to be set.
  @param \Cake\Validation\Validator $validator Validator object to be set.
  @return $this
docstring_tokens: This method stores a custom validator under the given name .