PHP 클래스 Neos\Flow\Validation\ValidatorResolver

파일 보기 프로젝트 열기: neos/flow-development-collection 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$baseValidatorConjunctions array
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
$reflectionService Neos\Flow\Reflection\ReflectionService

공개 메소드들

메소드 설명
buildMethodArgumentsValidatorConjunctions ( string $className, string $methodName, array $methodParameters = null, array $methodValidateAnnotations = null ) : array Detects and registers any validators for arguments: - by the data type specified in the param annotations - additional validators specified in the validate annotations of a method
createValidator ( string $validatorType, array $validatorOptions = [] ) : Neos\Flow\Validation\Validator\ValidatorInterface Get a validator for a given data type. Returns a validator implementing the ValidatorInterface or NULL if no validator could be resolved.
getBaseValidatorConjunction ( string $targetClassName, array $validationGroups = ['Default'] ) : ConjunctionValidator Resolves and returns the base validator conjunction for the given data type.
getPolyTypeObjectValidatorImplementationClassNames ( Neos\Flow\ObjectManagement\ObjectManagerInterface $objectManager ) : array Returns a map of object validator class names.
getValidatorImplementationClassNames ( Neos\Flow\ObjectManagement\ObjectManagerInterface $objectManager ) : array Returns all class names implementing the ValidatorInterface.
reset ( ) : void Resets the baseValidatorConjunctions It is usually not required to reset the ValidatorResolver during one request. This method is mainly useful for functional tests

보호된 메소드들

메소드 설명
addCustomValidators ( string $targetClassName, ConjunctionValidator &$conjunctionValidator ) : null | Neos\Flow\Validation\Validator\ObjectValidatorInterface This adds custom validators to the passed $conjunctionValidator.
buildBaseValidatorConjunction ( string $indexKey, string $targetClassName, array $validationGroups ) : void Builds a base validator conjunction for the given data type.
buildSubObjectValidator ( array $objectPath, Neos\Flow\Validation\Validator\ValidatorInterface $propertyValidator ) : GenericObjectValidator Builds a chain of nested object validators by specification of the given object path.
getValidatorType ( string $type ) : string Used to map PHP types to validator types.
resolveValidatorObjectName ( string $validatorType ) : string | boolean Returns the class name of an appropriate validator for the given type. If no validator is available FALSE is returned

메소드 상세

addCustomValidators() 보호된 메소드

A custom validator is found if it follows the naming convention "Replace '\Model\' by '\Validator\' and append 'Validator'". If found, it will be added to the $conjunctionValidator. In addition canValidate() will be called on all implementations of the ObjectValidatorInterface to find all validators that could validate the target. The one with the highest priority will be added as well. If multiple validators have the same priority, which one will be added is not deterministic.
protected addCustomValidators ( string $targetClassName, ConjunctionValidator &$conjunctionValidator ) : null | Neos\Flow\Validation\Validator\ObjectValidatorInterface
$targetClassName string
$conjunctionValidator Neos\Flow\Validation\Validator\ConjunctionValidator
리턴 null | Neos\Flow\Validation\Validator\ObjectValidatorInterface

buildBaseValidatorConjunction() 보호된 메소드

The base validation rules are those which were declared directly in a class (typically a model) through some validate annotations on properties. If a property holds a class for which a base validator exists, that property will be checked as well, regardless of a validate annotation Additionally, if a custom validator was defined for the class in question, it will be added to the end of the conjunction. A custom validator is found if it follows the naming convention "Replace '\Model\' by '\Validator\' and append 'Validator'". Example: $targetClassName is Neos\Foo\Domain\Model\Quux, then the validator will be found if it has the name Neos\Foo\Domain\Validator\QuuxValidator
protected buildBaseValidatorConjunction ( string $indexKey, string $targetClassName, array $validationGroups ) : void
$indexKey string The key to use as index in $this->baseValidatorConjunctions; calculated from target class name and validation groups
$targetClassName string The data type to build the validation conjunction for. Needs to be the fully qualified class name.
$validationGroups array The validation groups to build the validator for
리턴 void

buildMethodArgumentsValidatorConjunctions() 공개 메소드

Detects and registers any validators for arguments: - by the data type specified in the param annotations - additional validators specified in the validate annotations of a method
public buildMethodArgumentsValidatorConjunctions ( string $className, string $methodName, array $methodParameters = null, array $methodValidateAnnotations = null ) : array
$className string
$methodName string
$methodParameters array Optional pre-compiled array of method parameters
$methodValidateAnnotations array Optional pre-compiled array of validate annotations (as array)
리턴 array An Array of ValidatorConjunctions for each method parameters.

buildSubObjectValidator() 보호된 메소드

Builds a chain of nested object validators by specification of the given object path.
protected buildSubObjectValidator ( array $objectPath, Neos\Flow\Validation\Validator\ValidatorInterface $propertyValidator ) : GenericObjectValidator
$objectPath array The object path
$propertyValidator Neos\Flow\Validation\Validator\ValidatorInterface The validator which should be added to the property specified by objectPath
리턴 Neos\Flow\Validation\Validator\GenericObjectValidator

createValidator() 공개 메소드

Get a validator for a given data type. Returns a validator implementing the ValidatorInterface or NULL if no validator could be resolved.
public createValidator ( string $validatorType, array $validatorOptions = [] ) : Neos\Flow\Validation\Validator\ValidatorInterface
$validatorType string Either one of the built-in data types or fully qualified validator class name
$validatorOptions array Options to be passed to the validator
리턴 Neos\Flow\Validation\Validator\ValidatorInterface

getBaseValidatorConjunction() 공개 메소드

If no validation is necessary, the returned validator is empty.
public getBaseValidatorConjunction ( string $targetClassName, array $validationGroups = ['Default'] ) : ConjunctionValidator
$targetClassName string Fully qualified class name of the target class, ie. the class which should be validated
$validationGroups array The validation groups to build the validator for
리턴 Neos\Flow\Validation\Validator\ConjunctionValidator The validator conjunction

getPolyTypeObjectValidatorImplementationClassNames() 공개 정적인 메소드

Returns a map of object validator class names.
public static getPolyTypeObjectValidatorImplementationClassNames ( Neos\Flow\ObjectManagement\ObjectManagerInterface $objectManager ) : array
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
리턴 array Array of object validator class names

getValidatorImplementationClassNames() 공개 정적인 메소드

Returns all class names implementing the ValidatorInterface.
public static getValidatorImplementationClassNames ( Neos\Flow\ObjectManagement\ObjectManagerInterface $objectManager ) : array
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
리턴 array Array of class names implementing ValidatorInterface indexed by class name

getValidatorType() 보호된 메소드

Used to map PHP types to validator types.
protected getValidatorType ( string $type ) : string
$type string Data type to unify
리턴 string unified data type

reset() 공개 메소드

Resets the baseValidatorConjunctions It is usually not required to reset the ValidatorResolver during one request. This method is mainly useful for functional tests
public reset ( ) : void
리턴 void

resolveValidatorObjectName() 보호된 메소드

Returns the class name of an appropriate validator for the given type. If no validator is available FALSE is returned
protected resolveValidatorObjectName ( string $validatorType ) : string | boolean
$validatorType string Either the fully qualified class name of the validator or the short name of a built-in validator
리턴 string | boolean Class name of the validator or FALSE if not available

프로퍼티 상세

$baseValidatorConjunctions 보호되어 있는 프로퍼티

protected array $baseValidatorConjunctions
리턴 array

$objectManager 보호되어 있는 프로퍼티

protected ObjectManagerInterface,Neos\Flow\ObjectManagement $objectManager
리턴 Neos\Flow\ObjectManagement\ObjectManagerInterface

$reflectionService 보호되어 있는 프로퍼티

protected ReflectionService,Neos\Flow\Reflection $reflectionService
리턴 Neos\Flow\Reflection\ReflectionService