You are here

protected function AbstractLoader::addNamespaceAlias in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Mapping/Loader/AbstractLoader.php \Symfony\Component\Validator\Mapping\Loader\AbstractLoader::addNamespaceAlias()

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');

Parameters

string $alias The alias:

string $namespace The PHP namespace:

2 calls to AbstractLoader::addNamespaceAlias()
XmlFileLoader::loadClassMetadata in vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php
Loads validation metadata into a {@link ClassMetadata} instance.
YamlFileLoader::loadClassMetadata in vendor/symfony/validator/Mapping/Loader/YamlFileLoader.php
Loads validation metadata into a {@link ClassMetadata} instance.

File

vendor/symfony/validator/Mapping/Loader/AbstractLoader.php, line 53

Class

AbstractLoader
Base loader for validation metadata.

Namespace

Symfony\Component\Validator\Mapping\Loader

Code

protected function addNamespaceAlias($alias, $namespace) {
  $this->namespaces[$alias] = $namespace;
}