-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 3.1.10 |
When the unique field selected is a field with a Doctrine Custom Type, and there is a violation in the validation (i.e., the value already exists in the database), the method validate in UniqueEntityValidator throws a Doctrine/Common/Persistence/Mapping/MappingException: The class 'Whatever' was not found in the chain configured namespaces AppBundle\Entity
This is due to the modifications introduced in this commit: b3ced86
And is due to this method that is called to build the violation error in the validate method:
symfony/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php
Line 140 in b3ced86
private function formatWithIdentifiers(ObjectManager $em, ClassMetadata $class, $value) |
If the field value is an object (as in the case of a Doctrine custom type), it assumes that it's a Doctrine entity and try to get its identifiers, and there is when the exception is thrown, because the object is not an entity and it's not mapped