Drupal 8  8.0.2
RecursiveContextualValidator Class Reference
Inheritance diagram for RecursiveContextualValidator:

Public Member Functions

 __construct (ExecutionContextInterface $context, MetadataFactoryInterface $metadata_factory, ConstraintValidatorFactoryInterface $validator_factory, TypedDataManagerInterface $typed_data_manager)
 
 atPath ($path)
 
 validate ($data, $constraints=NULL, $groups=NULL, $is_root_call=TRUE)
 
 getViolations ()
 
 validateProperty ($object, $propertyName, $groups=NULL)
 
 validatePropertyValue ($object, $property_name, $value, $groups=NULL)
 

Protected Member Functions

 validateNode (TypedDataInterface $data, $constraints=NULL, $is_root_call=FALSE)
 
 validateConstraints ($value, $cache_key, $constraints)
 

Protected Attributes

 $context
 
 $metadataFactory
 
 $constraintValidatorFactory
 

Detailed Description

Defines a recursive contextual validator for Typed Data.

For both list and complex data it call recursively out to the properties / elements of the list.

This class calls out to some methods on the execution context marked as internal. These methods are internal to the validator (which is implemented by this class) but should not be called by users. See http://symfony.com/doc/current/contributing/code/bc.html for more information about

Constructor & Destructor Documentation

__construct ( ExecutionContextInterface  $context,
MetadataFactoryInterface  $metadata_factory,
ConstraintValidatorFactoryInterface  $validator_factory,
TypedDataManagerInterface  $typed_data_manager 
)

Creates a validator for the given context.

Parameters
\Symfony\Component\Validator\Context\ExecutionContextInterface$contextThe factory for creating new contexts.
\Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface$metadata_factoryThe metadata factory.
\Symfony\Component\Validator\ConstraintValidatorFactoryInterface$validator_factoryThe constraint validator factory.
\Drupal\Core\TypedData\TypedDataManagerInterface$typed_data_managerThe typed data manager.

References Drupal\typedDataManager().

Here is the call graph for this function:

Member Function Documentation

atPath (   $path)

{}

getViolations ( )

{}

validate (   $data,
  $constraints = NULL,
  $groups = NULL,
  $is_root_call = TRUE 
)

{Validates a value against a constraint or a list of constraints.If no constraint is passed, the constraint is assumed.

Parameters
mixed$valueThe value to validate
\Symfony\Component\Validator\Constraint|\Symfony\Component\Validator\Constraint[]$constraints The constraint(s) to validate against.
array | null$groupsThe validation groups to validate, defaults to "Default".
bool$is_root_call(optional) Whether its the most upper call in the typed data tree.
See Also
Returns
$this
}

Implements ContextualValidatorInterface.

References RecursiveContextualValidator\validateNode().

Referenced by RecursiveContextualValidator\validatePropertyValue().

Here is the call graph for this function:

Here is the caller graph for this function:

validateConstraints (   $value,
  $cache_key,
  $constraints 
)
protected

Validates a node's value against all constraints in the given group.

Parameters
mixed$valueThe validated value.
string$cache_keyThe cache key used internally to ensure we don't validate the same constraint twice.
\Symfony\Component\Validator\Constraint[]$constraints The constraints which should be ensured for the given value.

Referenced by RecursiveContextualValidator\validateNode().

Here is the caller graph for this function:

validateNode ( TypedDataInterface  $data,
  $constraints = NULL,
  $is_root_call = FALSE 
)
protected

Validates a Typed Data node in the validation tree.

If no constraints are passed, the data is validated against the constraints specified in its data definition. If the data is complex or a list and no constraints are passed, the contained properties or list items are validated recursively.

Parameters
\Drupal\Core\TypedData\TypedDataInterface$dataThe data to validated.
\Symfony\Component\Validator\Constraint[]|null$constraints (optional) If set, an array of constraints to validate.
bool$is_root_call(optional) Whether its the most upper call in the type data tree.
Returns
$this

References TypedDataInterface\getName(), Drupal\typedDataManager(), and RecursiveContextualValidator\validateConstraints().

Referenced by RecursiveContextualValidator\validate(), and RecursiveContextualValidator\validateProperty().

Here is the call graph for this function:

Here is the caller graph for this function:

validateProperty (   $object,
  $propertyName,
  $groups = NULL 
)

{}

References RecursiveContextualValidator\validateNode().

Here is the call graph for this function:

validatePropertyValue (   $object,
  $property_name,
  $value,
  $groups = NULL 
)

{}

References RecursiveContextualValidator\validate().

Here is the call graph for this function:


The documentation for this class was generated from the following file: