You are here

private function XmlFileLoader::loadClassMetadataFromXml in Zircon Profile 8

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

Loads the validation metadata from the given XML class description.

Parameters

ClassMetadata $metadata The metadata to load:

array $classDescription The XML class description:

1 call to XmlFileLoader::loadClassMetadataFromXml()
XmlFileLoader::loadClassMetadata in vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php
Loads validation metadata into a {@link ClassMetadata} instance.

File

vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php, line 191

Class

XmlFileLoader
Loads validation metadata from an XML file.

Namespace

Symfony\Component\Validator\Mapping\Loader

Code

private function loadClassMetadataFromXml(ClassMetadata $metadata, $classDescription) {
  foreach ($classDescription->{'group-sequence-provider'} as $_) {
    $metadata
      ->setGroupSequenceProvider(true);
  }
  foreach ($classDescription->{'group-sequence'} as $groupSequence) {
    if (count($groupSequence->value) > 0) {
      $metadata
        ->setGroupSequence($this
        ->parseValues($groupSequence[0]->value));
    }
  }
  foreach ($this
    ->parseConstraints($classDescription->constraint) as $constraint) {
    $metadata
      ->addConstraint($constraint);
  }
  foreach ($classDescription->property as $property) {
    foreach ($this
      ->parseConstraints($property->constraint) as $constraint) {
      $metadata
        ->addPropertyConstraint((string) $property['name'], $constraint);
    }
  }
  foreach ($classDescription->getter as $getter) {
    foreach ($this
      ->parseConstraints($getter->constraint) as $constraint) {
      $metadata
        ->addGetterConstraint((string) $getter['property'], $constraint);
    }
  }
}