FileLoader
extends AbstractLoader
in package
AbstractYes
Base loader for loading validation metadata from a file.
Tags
Table of Contents
Constants
- DEFAULT_NAMESPACE = '\\Symfony\\Component\\Validator\\Constraints\\'
- The namespace to load constraints from by default.
Properties
- $file : mixed
- $namespaces : mixed
Methods
- __construct() : mixed
- Creates a new loader.
- addNamespaceAlias() : mixed
- Adds a namespace alias.
- newConstraint() : Constraint
- Creates a new constraint instance for the given constraint name.
Constants
DEFAULT_NAMESPACE
The namespace to load constraints from by default.
public
mixed
DEFAULT_NAMESPACE
= '\\Symfony\\Component\\Validator\\Constraints\\'
Properties
$file
protected
mixed
$file
$namespaces
protected
mixed
$namespaces
= []
Methods
__construct()
Creates a new loader.
public
__construct(string $file) : mixed
Parameters
- $file : string
-
The mapping file to load
Tags
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
- $namespace : string
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