Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

UniqueEntityValidator fails when the unique value is a custom doctrine type field #21619

Copy link
Copy link
Closed
@magarzon

Description

@magarzon
Issue body actions
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:

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.