jop-software / doctrine-uuid-generators
Generate UUIDs for your doctrine models
Installs: 2 417
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- doctrine/orm: ^3.0
- symfony/uid: ^5.3 || ^6.0 || ^7.0
Requires (Dev)
- phpstan/phpstan: ^1.8
- phpunit/phpunit: ^9.5 | ^10.0
- symplify/easy-coding-standard: ^11.1
README
Doctrine UUID generators
Generate UUIDs for your doctrine entitiesInstallation
composer require jop-software/doctrine-uuid-generators
Usage
You can use all the generators in the CustomIdGenerator
annotation.
<?php namespace App\Entity; use App\Repository\EntityNameRepository; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use JopSoftware\DoctrineUuidGenerators\UuidV4Generator; use Symfony\Component\Uid\UuidV4; #[ORM\Entity(repositoryClass: EntityNameRepository::class)] class EntityName { #[ORM\Id] #[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\Column(type: "uuid", unique: true)] #[ORM\CustomIdGenerator(class: UuidV4Generator::class)] private UuidV4|null $id = null; public function getId(): UuidV4|null { return $this->id; } }
Available generators
Versions 3 and 5 are not implemented currently, because they are namespace based and there is no way currently to pass such a namespace to the generator in the
CustomIdGenerator
annotation.
Versions
Professional support
Professional support is available. Please contact support@jop-software.de for more information.
License
This project is licensed under the MIT LICENSE
© 2022-2024, jop-software Inh. Johannes Przymusinski