bug #10581 [Validator][Email] - When standalone "Fatal error: Class 'validator.email' not found" (egulias)

This PR was merged into the 2.5-dev branch.

Discussion
----------

[Validator][Email] - When standalone "Fatal error: Class 'validator.email' not found"

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/silexphp/Silex/issues/932
| License       | MIT
| Doc PR        | no

When using the validator as an standalone component a bug was introduced by overriding the `validatedBy()` method in the `Email` constraint.
This PR removes the override and implements a way for the DI to get the right validator.

Another way would be modifying the definition of validator to change the alias instead of having the FQCN in the xml

Commits
-------

e79b3a9 Change in validator.email service alias to match the validator FQCN
This commit is contained in:
Fabien Potencier 2014-03-30 09:34:45 +02:00
commit 95f8e43205
2 changed files with 1 additions and 9 deletions

View File

@ -73,7 +73,7 @@
<service id="validator.email" class="%validator.email.class%">
<argument></argument>
<tag name="validator.constraint_validator" alias="validator.email" />
<tag name="validator.constraint_validator" alias="Symfony\Component\Validator\Constraints\EmailValidator" />
</service>
</services>
</container>

View File

@ -26,12 +26,4 @@ class Email extends Constraint
public $checkMX = false;
public $checkHost = false;
public $strict = null;
/**
* {@inheritDoc}
*/
public function validatedBy()
{
return 'validator.email';
}
}