8000 Mapping fails for abstract class in DiscriminatorMap in 2.9 · Issue #8736 · doctrine/orm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Mapping fails for abstract class in DiscriminatorMap in 2.9 #8736
Closed
@StephaneLeveugle

Description

@StephaneLeveugle

Hi, after upgrading to 2.9 (from 2.8) I now get an error when validating my schema

My setup is the following

Parent

/**
 * @ORM\Entity
 * @ORM\InheritanceType("SINGLE_TABLE")
 * @ORM\DiscriminatorColumn(name="discriminant", type="string")
 * @ORM\DiscriminatorMap({
 *     "type_child_a" = ChildA::class,
 *     "type_child_b" = ChildB::class,
 *     "other_type" = OtherType::class
 * })
 */
abstract class Parent

AbstractType

/**
 * @ORM\Entity
 */
abstract class AbstractType extends Parent

ChildA

/**
 * @ORM\Entity
 */
class ChildA extends AbstractType

ChildB

/**
 * @ORM\Entity
 */
class ChildB extends AbstractType

OtherType

/**
 * @ORM\Entity
 */
class OtherType extends Parent

My issue is that after upgrading to 2.9, when validating the schema I now get the error

Entity class 'AbstractType' is part of inheritance hierarchy, but is not mapped in the root entity 'Parent' discriminator map. All subclasses must be listed in the discriminator map.

If I'm not mistaken, doctrine shouldn't expect AbstractType to be in the DiscriminatorMap because it is an abstract class?

If it wasn't supposed to be working before, do you have an alternative to achieve my desired outcome?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0