Skip to content

make:entity Test --with-ulid or make:entity Test --with-ulid does not use Ulid/Uuid #1577

Open
@lpotherat

Description

@lpotherat

Hi there, I love using Uuids / Ulids as primaries, and I jumped on this feature !
But it looks like it works only if we don't pass any parameters php bin/console make:entity --with-uuid

How to reproduce :

Execute php bin/console make:entity Test --with-uuid ( or php bin/console make:entity Test --with-ulid )
Follow steps to class creation and quit.

Expected :
The id field created like this :

#[ORM\Entity(repositoryClass: TestRepository::class)]
class Test
{
    #[ORM\Id]
    #[ORM\Column(type: UuidType::NAME, unique: true)]
    #[ORM\GeneratedValue(strategy: 'CUSTOM')]
    #[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
    private ?Uuid $id = null;

    public function getId(): ?Uuid
    {
        return $this->id;
    }
}

Actual result:

#[ORM\Entity(repositoryClass: TestRepository::class)]
class Test
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    public function getId(): ?int
    {
        return $this->id;
    }
}

Metadata

Metadata

Assignees

Labels

BugBug FixStatus: ReviewedHas been reviewed by a maintainer

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions