Skip to content

Doctrine Annotation to Attributes - DiscriminatorMap: index for int should be preserved #7345

@Chris53897

Description

@Chris53897

Hi, Thanks a lot for your work.

Rector version: 80bfee9

Int-Indexed DiscriminatorMap lose there index after the conversion.

DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES

The index is getting lost. It starts with 0.
Problem: Doctrine does not find the entites anymore.

Before:

/** 
 * @ORM\Entity
 * @ORM\Table(name="tour_rbgl_billing")
 * @ORM\InheritanceType("SINGLE_TABLE")
 * @ORM\DiscriminatorColumn(name="item_type", type="integer")
 * @ORM\DiscriminatorMap({ "1" = "CostDetailEntity" })
 */

After:

#[ORM\Entity]
#[ORM\Table(name: 'tour_rbgl_billing')]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'item_type', type: 'integer')]
#[ORM\DiscriminatorMap(['CostDetailEntity'])]

Expected Behaviour

The index should be preserved.

#[ORM\DiscriminatorMap([1 => 'CostDetailEntity'])]

Special Case would be 0,1,2...N with increment by 1. In this case the actual behaviour is correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions