You are here

protected function AbstractLoader::addNamespaceAlias in Plug 7

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 lib/Symfony/validator/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php
Loads validation metadata into a {@link ClassMetadata} instance.
YamlFileLoader::loadClassMetadata in lib/Symfony/validator/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php
Loads validation metadata into a {@link ClassMetadata} instance.

File

lib/Symfony/validator/Symfony/Component/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;
}