You are here

private function RecursiveContextualValidator::stepThroughGroupSequence in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Validator/RecursiveContextualValidator.php \Symfony\Component\Validator\Validator\RecursiveContextualValidator::stepThroughGroupSequence()

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 vendor/symfony/validator/Validator/RecursiveContextualValidator.php
Validates a class node.
RecursiveContextualValidator::validateGenericNode in vendor/symfony/validator/Validator/RecursiveContextualValidator.php
Validates a node that is not a class node.

File

vendor/symfony/validator/Validator/RecursiveContextualValidator.php, line 801

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;
    }
  }
}