maker-bundle icon indicating copy to clipboard operation
maker-bundle copied to clipboard

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

Open lpotherat opened this issue 7 months ago • 3 comments

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;
    }
}

lpotherat avatar Jun 26 '24 13:06 lpotherat