private function YamlFileLoader::loadClassMetadataFromYaml in Plug 7
Loads the validation metadata from the given YAML class description.
Parameters
ClassMetadata $metadata The metadata to load:
array $classDescription The YAML class description:
1 call to YamlFileLoader::loadClassMetadataFromYaml()
- YamlFileLoader::loadClassMetadata in lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Mapping/ Loader/ YamlFileLoader.php - Loads validation metadata into a {@link ClassMetadata} instance.
File
- lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Mapping/ Loader/ YamlFileLoader.php, line 141
Class
- YamlFileLoader
- Loads validation metadata from a YAML file.
Namespace
Symfony\Component\Validator\Mapping\LoaderCode
private function loadClassMetadataFromYaml(ClassMetadata $metadata, array $classDescription) {
if (isset($classDescription['group_sequence_provider'])) {
$metadata
->setGroupSequenceProvider((bool) $classDescription['group_sequence_provider']);
}
if (isset($classDescription['group_sequence'])) {
$metadata
->setGroupSequence($classDescription['group_sequence']);
}
if (isset($classDescription['constraints']) && is_array($classDescription['constraints'])) {
foreach ($this
->parseNodes($classDescription['constraints']) as $constraint) {
$metadata
->addConstraint($constraint);
}
}
if (isset($classDescription['properties']) && is_array($classDescription['properties'])) {
foreach ($classDescription['properties'] as $property => $constraints) {
if (null !== $constraints) {
foreach ($this
->parseNodes($constraints) as $constraint) {
$metadata
->addPropertyConstraint($property, $constraint);
}
}
}
}
if (isset($classDescription['getters']) && is_array($classDescription['getters'])) {
foreach ($classDescription['getters'] as $getter => $constraints) {
if (null !== $constraints) {
foreach ($this
->parseNodes($constraints) as $constraint) {
$metadata
->addGetterConstraint($getter, $constraint);
}
}
}
}
}