You are here

public function ValidatorBuilder::addMethodMappings in Plug 7

Enables constraint mapping using the given static methods.

Parameters

array $methodNames The names of the methods:

Return value

ValidatorBuilderInterface The builder object

Overrides ValidatorBuilderInterface::addMethodMappings

File

lib/Symfony/validator/Symfony/Component/Validator/ValidatorBuilder.php, line 198

Class

ValidatorBuilder
The default implementation of {@link ValidatorBuilderInterface}.

Namespace

Symfony\Component\Validator

Code

public function addMethodMappings(array $methodNames) {
  if (null !== $this->metadataFactory) {
    throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.');
  }
  $this->methodMappings = array_merge($this->methodMappings, $methodNames);
  return $this;
}