symfony/symfony — Issue #3041: [S2.0.8][DoctrineBridge][Validator] UniqueEntityValidator never being executed.
Author: oscarballadares
Created: 2012-01-05 18:56:53+00:00
State: open

Hi everyone, I'm working on a fresh Symfony 2.0.8 project.

UniqueEntity constraint seem to being not working. I'm using yml validation file:

```php
NicaStaff\IQCoreBundle\Entity\User:
constraints:
- \Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity: { fields: email, message: This email is already used }
properties:
first_name:
- NotBlank: { groups: [default] }
```
The assertion is being skipped, so I got a MySQL duplicated entry error.

In the doctrine mapping 'email' is unique and string(255) (Hopefully this has nothing to do with the issue).

Following the stack and messing up with files and code I found that UniqueEntity Constraint is being executed but the validatedBy() method is not being overrided.

In the other hand, UniqueEntityValidator is never being executed.

As opposite, a working Symfony 2.0.5 previous project the UniqueEntity assert is working like a charm. If I mess up with the sames files it is clear that UniqueEntityValidator is being executed and the UniqueEntity::validatedBy() is being correctly override.

Any workaround for this? Did I miss something?

Regards.