YamlFileLoader
class YamlFileLoader extends FileLoader
Loads validation metadata from a YAML file.
Constants
DEFAULT_NAMESPACE |
The namespace to load constraints from by default. |
Properties
protected | $namespaces | from AbstractLoader | |
protected | $file | from FileLoader | |
protected array | $classes | An array of YAML class descriptions. |
Methods
newConstraint(string $name, mixed $options = null)
Creates a new constraint instance for the given constraint name.
from AbstractLoader
bool
loadClassMetadata(ClassMetadata $metadata)
Loads validation metadata into a {@link ClassMetadata} instance.
string[]
getMappedClasses()
Return the names of the classes mapped in this file.
array
parseNodes(array $nodes)
Parses a collection of YAML nodes.
Details
protected
addNamespaceAlias(string $alias, string $namespace)
Adds a namespace alias.
The namespace alias can be used to reference constraints from specific namespaces in {@link newConstraint()}:
$this->addNamespaceAlias('mynamespace', '\\Acme\\Package\\Constraints\\');
$constraint = $this->newConstraint('mynamespace:NotNull');
protected Constraint
newConstraint(string $name, mixed $options = null)
Creates a new constraint instance for the given constraint name.
bool
loadClassMetadata(ClassMetadata $metadata)
Loads validation metadata into a {@link ClassMetadata} instance.