Skip to content

UniqueEntityValidator in SingleTableInheritance #17962

@Nemo64

Description

@Nemo64

I have multiple kinds of entities within a single table inheritance. The UniqueEntityValidator fails in that scenario as it uses get_class($entity). It instead should use the class on which it is defined.

Example:

/**
 * @ORM\InheritanceType("SINGLE_TABLE")
 * @ORM\DiscriminatorColumn(name="discr", type="string", length=15)
 * @UniqueEntity(fields={"email"})
 */
class User {
    /** @ORM\Column(type="string") */
    private $email;
}
class Collaborator extends User {}

Validating the Collaborator will now only check for other Collaborators with the same email.

I'm using symfony 2.7.10.

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