From 1b7a89ea9f78866a81791335f838e6ba9a317c8c Mon Sep 17 00:00:00 2001 From: Samuele Date: Tue, 24 May 2016 11:59:47 +0200 Subject: [PATCH] Update custom_constraint.rst You have to specify an alias as of ``` //Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory.php [...] $name = $constraint->validatedBy(); if (!isset($this->validators[$name])) { $this->validators[$name] = new $name(); //LOOK HERE; IF I DON'T SPECIFY THIS ALIAS, I WILL END HERE; NO SERVICE THERE! } elseif (is_string($this->validators[$name])) { $this->validators[$name] = $this->container->get($this->validators[$name]); } [...] ``` --- cookbook/validation/custom_constraint.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/validation/custom_constraint.rst b/cookbook/validation/custom_constraint.rst index 0c42758dd93..1aa362f5224 100644 --- a/cookbook/validation/custom_constraint.rst +++ b/cookbook/validation/custom_constraint.rst @@ -158,7 +158,7 @@ Constraint Validators with Dependencies If your constraint validator has dependencies, such as a database connection, it will need to be configured as a service in the Dependency Injection Container. This service must include the ``validator.constraint_validator`` -tag and may include an ``alias`` attribute: +tag and *MUST* include an ``alias`` attribute: .. configuration-block::