src/Articus/DataTransfer/Validator.php
protected function getValidator($field)
	{
		$result = null;
		if (isset($this->validators[$field]))
		{
			$result = $this->validators[$field];
		}
		else
		{
			$result = new ValidatorChain();
			$result->setPluginManager($this->validatorPluginManager);
			if (isset($this->metadata->validators[$field]))
			{
				foreach ($this->metadata->validators[$field] as $validator)
				{
					/** @var $validator Annotation\Validator */
					$result->attachByName($validator->name, $validator->options, true, $validator->priority);
				}
			}
			if (($field !== self::GLOBAL_VALIDATOR_KEY) && ($this->metadata->nullables[$field] === false))
			{
				$result->attachByName(NotEmpty::class, ['type' => NotEmpty::NULL | NotEmpty::OBJECT], true, 10000);
			}
			$this->validators[$field] = $result;
		}
		return $result;
	}
protected function getValidator($field)
	{
		$result = null;
		if (isset($this->validators[$field]))
		{
			$result = $this->validators[$field];
		}
		else
		{
			$result = new ValidatorChain();
			$result->setPluginManager($this->validatorPluginManager);
			if (isset($this->metadata->validators[$field]))
			{
				foreach ($this->metadata->validators[$field] as $validator)
				{
					/** @var $validator Annotation\Validator */
					$result->attachByName($validator->name, $validator->options, true, $validator->priority);
				}
			}
			if (($field !== self::GLOBAL_VALIDATOR_KEY) && ($this->metadata->nullables[$field] === false))
			{
				$result->attachByName(NotEmpty::class, ['type' => NotEmpty::NULL | NotEmpty::OBJECT], true, 10000);
			}
			$this->validators[$field] = $result;
		}
		return $result;
	}
protected function getValidator ( $ field ) { $ result = null ; if ( isset ( $ this -> validators [ $ field ] ) ) { $ result = $ this -> validators [ $ field ] ; } else { $ result = new ValidatorChain ( ) ; $ result -> setPluginManager ( $ this -> validatorPluginManager ) ; if ( isset ( $ this -> metadata -> validators [ $ field ] ) ) { foreach ( $ this -> metadata -> validators [ $ field ] as $ validator ) { /** @var $validator Annotation\Validator */ $ result -> attachByName ( $ validator -> name , $ validator -> options , true , $ validator -> priority ) ; } } if ( ( $ field !== self :: GLOBAL_VALIDATOR_KEY ) && ( $ this -> metadata -> nullables [ $ field ] === false ) ) { $ result -> attachByName ( NotEmpty :: class , [ 'type' => NotEmpty :: NULL | NotEmpty :: OBJECT ] , true , 10000 ) ; } $ this -> validators [ $ field ] = $ result ; } return $ result ; }
Builds validator chain for specified field according metadata
@param string $field
@return ValidatorInterface
Builds validator chain for specified field according metadata