private function XmlFileLoader::loadClassMetadataFromXml in Plug 7
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 lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Mapping/ Loader/ XmlFileLoader.php - Loads validation metadata into a {@link ClassMetadata} instance.
File
- lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Mapping/ Loader/ XmlFileLoader.php, line 191
Class
- XmlFileLoader
- Loads validation metadata from an XML file.
Namespace
Symfony\Component\Validator\Mapping\LoaderCode
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);
}
}
}