Created
August 20, 2020 15:34
-
-
Save parijke/c042ceebc1e3983c55e182fe047d8a88 to your computer and use it in GitHub Desktop.
Generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Entity\Generator; | |
use Doctrine\ORM\EntityManager; | |
use Doctrine\ORM\Id\AbstractIdGenerator; | |
use Symfony\Component\Uid\Uuid; | |
class UuidGenerator extends AbstractIdGenerator | |
{ | |
/** | |
* Generates an identifier for an entity. | |
* | |
* @param EntityManager $em | |
* @param object|null $entity | |
* @return mixed | |
*/ | |
public function generate(EntityManager $em, $entity): uuid { | |
return uuid::v4(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment