Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doctrine - Optional feature $id as UUID instead of Integer when creating new entity #1033

Closed
skocdopolet opened this issue Dec 6, 2021 · 4 comments

Comments

@skocdopolet
Copy link

Description

I am working on a new project in Symfony 5.3. I am using this command bin/console make:entity for creating entities.

This wizard automatically creates an entity with $id as primary key of type integer. I am prefering UUID instead of integer.

How I should change settings to get Entity like example?

Example

namespace App\Entity;

use App\Repository\EventRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;

/**

  • @Orm\Entity(repositoryClass=EventRepository::class)
    /
    class Event
    {
    /
    *

    • @Orm\Id
    • @Orm\Column(type="uuid", unique=true)
    • @Orm\GeneratedValue(strategy="CUSTOM")
    • @Orm\CustomIdGenerator(class=UuidGenerator::class)
      */
      private $id;

    ...
    }

@chapterjason
Copy link

chapterjason commented Dec 6, 2021

Hey @skocdopolet this is part of the https://github.com/symfony/maker-bundle repository.
For customized maker have a look in the docs: https://symfony.com/bundles/SymfonyMakerBundle/current/index.html#overriding-the-generated-code

@OskarStark
Copy link
Contributor

@weaverryan friendly ping to move this issue, I am currently on a phone and can't do it 🤷🏼‍♂️😃

@xabbuh xabbuh transferred this issue from symfony/symfony Dec 7, 2021
@skocdopolet
Copy link
Author

Hello, is there please some progress? Thanks

@jrushlow
Copy link
Collaborator

Duplicate of #745 - we'll have PR #1329 merge / released soon!

@jrushlow jrushlow closed this as not planned Won't fix, can't repro, duplicate, stale Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants