You are here

public function ClassMetadata::accept in Zircon Profile 8

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

Overrides GenericMetadata::accept

Deprecated

since version 2.5, to be removed in 3.0.

File

vendor/symfony/validator/Mapping/ClassMetadata.php, line 134

Class

ClassMetadata
Default implementation of {@link ClassMetadataInterface}.

Namespace

Symfony\Component\Validator\Mapping

Code

public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath, $propagatedGroup = null) {
  @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  if (null === $propagatedGroup && Constraint::DEFAULT_GROUP === $group && ($this
    ->hasGroupSequence() || $this
    ->isGroupSequenceProvider())) {
    if ($this
      ->hasGroupSequence()) {
      $groups = $this
        ->getGroupSequence()->groups;
    }
    else {
      $groups = $value
        ->getGroupSequence();
    }
    foreach ($groups as $group) {
      $this
        ->accept($visitor, $value, $group, $propertyPath, Constraint::DEFAULT_GROUP);
      if (count($visitor
        ->getViolations()) > 0) {
        break;
      }
    }
    return;
  }
  $visitor
    ->visit($this, $value, $group, $propertyPath);
  if (null !== $value) {
    $pathPrefix = empty($propertyPath) ? '' : $propertyPath . '.';
    foreach ($this
      ->getConstrainedProperties() as $property) {
      foreach ($this
        ->getPropertyMetadata($property) as $member) {
        $member
          ->accept($visitor, $member
          ->getPropertyValue($value), $group, $pathPrefix . $property, $propagatedGroup);
      }
    }
  }
}