mediatekformation

XmlFileLoader extends FileLoader
in package

Loads validation metadata from an XML file.

Tags
author

Bernhard Schussek bschussek@gmail.com

Table of Contents

DEFAULT_NAMESPACE  = '\\Symfony\\Component\\Validator\\Constraints\\'
The namespace to load constraints from by default.
$classes  : array<string|int, SimpleXMLElement>|null
The XML nodes of the mapping file.
$file  : mixed
$namespaces  : mixed
__construct()  : mixed
Creates a new loader.
getMappedClasses()  : array<string|int, string>
Return the names of the classes mapped in this file.
loadClassMetadata()  : mixed
{@inheritdoc}
addNamespaceAlias()  : mixed
Adds a namespace alias.
newConstraint()  : Constraint
Creates a new constraint instance for the given constraint name.
parseConstraints()  : array<string|int, mixed>
Parses a collection of "constraint" XML nodes.
parseFile()  : SimpleXMLElement
Loads the XML class descriptions from the given file.
parseOptions()  : array<string|int, mixed>
Parses a collection of "option" XML nodes.
parseValues()  : array<string|int, mixed>
Parses a collection of "value" XML nodes.
loadClassesFromXml()  : mixed
loadClassMetadataFromXml()  : mixed

Constants

DEFAULT_NAMESPACE

The namespace to load constraints from by default.

public mixed DEFAULT_NAMESPACE = '\\Symfony\\Component\\Validator\\Constraints\\'

Properties

$classes

The XML nodes of the mapping file.

protected array<string|int, SimpleXMLElement>|null $classes

Methods

__construct()

Creates a new loader.

public __construct(string $file) : mixed
Parameters
$file : string

The mapping file to load

Tags
throws
MappingException

If the file does not exist or is not readable

Return values
mixed

getMappedClasses()

Return the names of the classes mapped in this file.

public getMappedClasses() : array<string|int, string>
Return values
array<string|int, string>

The classes names

addNamespaceAlias()

Adds a namespace alias.

protected addNamespaceAlias(string $alias, string $namespace) : mixed

The namespace alias can be used to reference constraints from specific namespaces in :

$this->addNamespaceAlias('mynamespace', '\\Acme\\Package\\Constraints\\');

$constraint = $this->newConstraint('mynamespace:NotNull');
Parameters
$alias : string

The alias

$namespace : string

The PHP namespace

Return values
mixed

newConstraint()

Creates a new constraint instance for the given constraint name.

protected newConstraint(string $name[, mixed $options = null ]) : Constraint
Parameters
$name : string

The constraint name. Either a constraint relative to the default constraint namespace, or a fully qualified class name. Alternatively, the constraint may be preceded by a namespace alias and a colon. The namespace alias must have been defined using .

$options : mixed = null

The constraint options

Tags
throws
MappingException

If the namespace prefix is undefined

Return values
Constraint

parseConstraints()

Parses a collection of "constraint" XML nodes.

protected parseConstraints(SimpleXMLElement $nodes) : array<string|int, mixed>
Parameters
$nodes : SimpleXMLElement

The XML nodes

Return values
array<string|int, mixed>

The Constraint instances

parseFile()

Loads the XML class descriptions from the given file.

protected parseFile(string $path) : SimpleXMLElement
Parameters
$path : string

The path of the XML file

Tags
throws
MappingException

If the file could not be loaded

Return values
SimpleXMLElement

The class descriptions

parseOptions()

Parses a collection of "option" XML nodes.

protected parseOptions(SimpleXMLElement $nodes) : array<string|int, mixed>
Parameters
$nodes : SimpleXMLElement

The XML nodes

Return values
array<string|int, mixed>

The options

parseValues()

Parses a collection of "value" XML nodes.

protected parseValues(SimpleXMLElement $nodes) : array<string|int, mixed>
Parameters
$nodes : SimpleXMLElement

The XML nodes

Return values
array<string|int, mixed>

The values

loadClassesFromXml()

private loadClassesFromXml() : mixed
Return values
mixed

loadClassMetadataFromXml()

private loadClassMetadataFromXml(ClassMetadata $metadata, SimpleXMLElement $classDescription) : mixed
Parameters
$metadata : ClassMetadata
$classDescription : SimpleXMLElement
Return values
mixed

Search results