Skip to content

Doctrine type "uuid" does not have any registered descriptor using Symfony UUID #682

@whataboutpereira

Description

@whataboutpereira

I've set up a working UUID like this as per Symfony documentation:

use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Uid\Uuid;

#[ORM\Entity]
class Test
{
    #[ORM\Id]
    #[ORM\Column(type: UuidType::NAME, unique: true)]
    #[ORM\GeneratedValue(strategy: 'CUSTOM')]
    #[ORM\CustomIdGenerator(class: UuidGenerator::class)]
    private ?Uuid $uuid;

    public function getUuid(): ?Uuid
    {
        return $this->uuid;
    }
}

However it yields:

Property App\Entity\Test::$uuid: Doctrine type "uuid" does not have any registered descriptor.
         🪪  doctrine.descriptorNotFound

I see descriptor support for ramsey/uuid, but how can I make it understand the symfony/uid type descriptor?

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