arokettu / uuid-doctrine
为arokettu/uuid提供Doctrine支持
2.0.6
2024-07-07 23:44 UTC
Requires
- php: ^8.2
- arokettu/is-resource: ^1.0
- arokettu/uuid: ^1.3 | ^2.0 | ^3.0 | ^4.0
- doctrine/dbal: ^4.0
Requires (Dev)
- arokettu/clock: ^2.2
- doctrine/orm: ^3.0
- phpunit/phpunit: ^10.2
- sandfox.dev/code-standard: ^1.2024.07.05
- squizlabs/php_codesniffer: *
- vimeo/psalm: ^5.13
README
arokettu/uuid
为Doctrine提供的列类和ID生成器。
安装
composer require arokettu/uuid-doctrine
- 1.x版本适用于
doctrine/dbal
v3 - 2.x版本适用于
doctrine/dbal
v4
版本之间完全可互换,除了对DBAL的严格依赖。
使用
<?php use Arokettu\Uuid\Doctrine\{UuidType,UuidV4Generator}; use Arokettu\Uuid\Uuid; use Doctrine\ORM\Mapping\{Column,CustomIdGenerator,Entity,GeneratedValue,Id,Table}; #[Entity, Table(name: 'uuid_object')] class UuidObject { #[Column(type: UuidType::NAME)] #[Id, GeneratedValue(strategy: 'CUSTOM'), CustomIdGenerator(UuidV4Generator::class)] public Uuid $id; #[Column(type: UuidType::NAME)] public Uuid $uuidString; }
文档
在此处阅读基础库的完整文档:https://sandfox.dev/php/uuid.html
同样在Read the Docs上: https://arokettu-uuid.readthedocs.io/
支持
请在GitLab的主仓库中提交问题:https://gitlab.com/sandfox/php-uuid/-/issues
在Gitter的房间里随时提问:https://gitter.im/arokettu/community
1.x和2.x版本都受到积极支持。
许可
该库作为开源软件,根据MIT许可证条款提供。