Skip to content

SequenceGenerator not working in MappedSuperclass #12390

@mgiraud

Description

@mgiraud

Bug Report

Q A
Version 3.6.2

Summary

A SequenceGenerator defined in the MappedSuperclass does not modify the generated sequence name.

How to reproduce

MappedSuperClass

#[ORM\MappedSuperclass]
class ParentSuperclass
{
    #[ORM\Column(name: "id_parent", type: Types::INTEGER)]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: "SEQUENCE")]
    #[ORM\SequenceGenerator(sequenceName: 'seq_id_parent')]
    protected ?int $id = null;
}

Child

#[ORM\Entity]
#[ORM\Table(name: 'child')]
class Child extends ParentSuperclass
{}

doctrine:schema:update --dump-sql

CREATE SEQUENCE child_id_parent_seq INCREMENT BY 1 MINVALUE 1 START 1;
CREATE TABLE child (id_parent INT NOT NULL, PRIMARY KEY (id_parent));

This can be worked around by moving the $id property with attributes to the Child class.

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