You are here

private function RecursiveContextualValidator::stepThroughGroupSequence in Plug 7

Sequentially validates a node's value in each group of a group sequence.

If any of the constraints generates a violation, subsequent groups in the group sequence are skipped.

Parameters

mixed $value The validated value:

object|null $object The current object:

string $cacheKey The key for caching: the validated value

MetadataInterface $metadata The metadata of the: value

string $propertyPath The property path leading: to the value

int $traversalStrategy The strategy used for: traversing the value

GroupSequence $groupSequence The group sequence:

string[]|null $cascadedGroup The group that should: be passed to cascaded objects instead of the group sequence

ExecutionContextInterface $context The execution context:

2 calls to RecursiveContextualValidator::stepThroughGroupSequence()
RecursiveContextualValidator::validateClassNode in lib/Symfony/validator/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php
Validates a class node.
RecursiveContextualValidator::validateGenericNode in lib/Symfony/validator/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php
Validates a node that is not a class node.

File

lib/Symfony/validator/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php, line 791

Class

RecursiveContextualValidator
Recursive implementation of {@link ContextualValidatorInterface}.

Namespace

Symfony\Component\Validator\Validator

Code

private function stepThroughGroupSequence($value, $object, $cacheKey, MetadataInterface $metadata = null, $propertyPath, $traversalStrategy, GroupSequence $groupSequence, $cascadedGroup, ExecutionContextInterface $context) {
  $violationCount = count($context
    ->getViolations());
  $cascadedGroups = $cascadedGroup ? array(
    $cascadedGroup,
  ) : null;
  foreach ($groupSequence->groups as $groupInSequence) {
    $groups = array(
      $groupInSequence,
    );
    if ($metadata instanceof ClassMetadataInterface) {
      $this
        ->validateClassNode($value, $cacheKey, $metadata, $propertyPath, $groups, $cascadedGroups, $traversalStrategy, $context);
    }
    else {
      $this
        ->validateGenericNode($value, $object, $cacheKey, $metadata, $propertyPath, $groups, $cascadedGroups, $traversalStrategy, $context);
    }

    // Abort sequence validation if a violation was generated
    if (count($context
      ->getViolations()) > $violationCount) {
      break;
    }
  }
}