PHP Class Neos\Flow\Validation\Validator\GenericObjectValidator

Inheritance: extends AbstractValidator, implements Neos\Flow\Validation\Validator\ObjectValidatorInterface
ファイルを表示 Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$propertyValidators array
$validatedInstancesContainer SplObjectStorage

Public Methods

Method Description
addPropertyValidator ( string $propertyName, Neos\Flow\Validation\Validator\ValidatorInterface $validator ) : void Adds the given validator for validation of the specified property.
getPropertyValidators ( string $propertyName = null ) : array Returns all property validators - or only validators of the specified property
setValidatedInstancesContainer ( SplObjectStorage $validatedInstancesContainer ) : void Allows to set a container to keep track of validated instances.
validate ( mixed $value ) : Neos\Error\Messages\Result Checks if the given value is valid according to the validator, and returns the Error Messages object which occurred.

Protected Methods

Method Description
checkProperty ( mixed $value, array $validators ) : null | Neos\Error\Messages\Result Checks if the specified property of the given object is valid, and adds found errors to the $messages object.
getPropertyValue ( object $object, string $propertyName ) : mixed Load the property value to be used for validation.
isValid ( mixed $object ) : void Checks if the given value is valid according to the property validators.
isValidatedAlready ( object $object ) : boolean

Method Details

addPropertyValidator() public method

Adds the given validator for validation of the specified property.
public addPropertyValidator ( string $propertyName, Neos\Flow\Validation\Validator\ValidatorInterface $validator ) : void
$propertyName string Name of the property to validate
$validator Neos\Flow\Validation\Validator\ValidatorInterface The property validator
return void

checkProperty() protected method

Checks if the specified property of the given object is valid, and adds found errors to the $messages object.
protected checkProperty ( mixed $value, array $validators ) : null | Neos\Error\Messages\Result
$value mixed The value to be validated
$validators array The validators to be called on the value
return null | Neos\Error\Messages\Result

getPropertyValidators() public method

Returns all property validators - or only validators of the specified property
public getPropertyValidators ( string $propertyName = null ) : array
$propertyName string Name of the property to return validators for
return array An array of validators

getPropertyValue() protected method

In case the object is a doctrine proxy, we need to load the real instance first.
protected getPropertyValue ( object $object, string $propertyName ) : mixed
$object object
$propertyName string
return mixed

isValid() protected method

Checks if the given value is valid according to the property validators.
protected isValid ( mixed $object ) : void
$object mixed The value that should be validated
return void

isValidatedAlready() protected method

protected isValidatedAlready ( object $object ) : boolean
$object object
return boolean

setValidatedInstancesContainer() public method

Allows to set a container to keep track of validated instances.
public setValidatedInstancesContainer ( SplObjectStorage $validatedInstancesContainer ) : void
$validatedInstancesContainer SplObjectStorage A container to keep track of validated instances
return void

validate() public method

Checks if the given value is valid according to the validator, and returns the Error Messages object which occurred.
public validate ( mixed $value ) : Neos\Error\Messages\Result
$value mixed The value that should be validated
return Neos\Error\Messages\Result

Property Details

$propertyValidators protected_oe property

protected array $propertyValidators
return array

$validatedInstancesContainer protected_oe property

protected SplObjectStorage $validatedInstancesContainer
return SplObjectStorage