symfony/symfony — pull request #9647 by xabbuh (2013-11-28 16:12:51+00:00)
Title: use the correct class name to retrieve mapped class' metadata and reposi...

...tory

| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #9646
| License | MIT
| Doc PR |

The validation context isn't necessarily the entity being validated. In case that you added the Unique Entity constraint inside your custom type via the ``constraints`` option the validation context will be the ``Form`` class itself. Thus, not the validation context should be used to get the class metadata and the repository of the validated entity, but the entity itself should be used.