abstract class AbstractLoader implements LoaderInterface
Base loader for validation metadata.
This loader supports the loading of constraints from Symfony's default namespace (see {@link DEFAULT_NAMESPACE}) using the short class names of those constraints. Constraints can also be loaded using their fully qualified class names. At last, namespace aliases can be defined to load constraints with the syntax "alias:ShortName".
DEFAULT_NAMESPACE | The namespace to load constraints from by default. |
protected | $namespaces |
addNamespaceAlias(string $alias, string $namespace) Adds a namespace alias. | ||
Constraint | newConstraint(string $name, mixed $options = null) Creates a new constraint instance for the given constraint name. |
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');
string | $alias | The alias |
string | $namespace | The PHP namespace |
Creates a new constraint instance for the given constraint name.
string | $name | 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 {@link addNamespaceAlias()}. |
mixed | $options | The constraint options |
Constraint |
MappingException | If the namespace prefix is undefined |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.html