You are here

public function ClassMetadata::accept in Plug 7

Overrides GenericMetadata::accept

Deprecated

Deprecated since version 2.5, to be removed in Symfony 3.0.

File

lib/Symfony/validator/Symfony/Component/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) {
  if (null === $propagatedGroup && Constraint::DEFAULT_GROUP === $group && ($this
    ->hasGroupSequence() || $this
    ->isGroupSequenceProvider())) {
    if ($this
      ->hasGroupSequence()) {
      $groups = $this
        ->getGroupSequence();
    }
    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);
      }
    }
  }
}