arokettu/uuid-doctrine

为arokettu/uuid提供Doctrine支持

2.0.6 2024-07-07 23:44 UTC

This package is auto-updated.

Last update: 2024-08-28 10:59:48 UTC


README

Packagist PHP License Gitlab pipeline status Codecov

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许可证条款提供。