Skip to content

make:entity and enums #1440

@klkvsk

Description

@klkvsk

It seems entity generator is unable to handle enums.
On an existing entity class

#[ORM\Entity]
class MyEntity
{
    // ...
    #[ORM\Column(nullable: false)]
    protected MyEntityType $type;
    // ...

make:entity --regenerate outputs enum's backed type (or is it getting it from mapped field type actually?):

    public function getType(): ?string
    {
        return $this->type;
    }

    public function setType(string $type): static
    {
        $this->type = $type;

        return $this;
    }

Also, when running make:entity as a command-line wizard, while creating a property there is no option for enum type.

Quick browse of maker-bundle's code showed almost nothing about enums.
Is it really unsupported yet?
Can it be fixed to generate a proper param/return type hint at least?

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