XmlFileLoader
class XmlFileLoader extends FileLoader
Loads validation metadata from an XML file.
Constants
DEFAULT_NAMESPACE |
The namespace to load constraints from by default. |
Properties
protected | $namespaces | from AbstractLoader | |
protected | $file | from FileLoader | |
protected SimpleXMLElement[]|null | $classes | The XML nodes of the mapping file. |
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
array
array
parseFile(string $path)
Loads the XML class descriptions from the given file.
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.
protected array
parseConstraints(SimpleXMLElement $nodes)
Parses a collection of "constraint" XML nodes.
protected SimpleXMLElement
parseFile(string $path)
Loads the XML class descriptions from the given file.