arokettu/uuid-doctrine

Doctrine support for arokettu/uuid

2.0.6 2024-07-07 23:44 UTC

This package is auto-updated.

Last update: 2024-11-28 11:34:27 UTC


README

Packagist PHP License Gitlab pipeline status Codecov

arokettu/uuid column classes and ID generators for Doctrine.

Installation

composer require arokettu/uuid-doctrine
  • Version 1.x is for doctrine/dbal v3
  • Version 2.x is for doctrine/dbal v4

The versions are fully interchangeable except for hard dependency on DBAL.

Usage

<?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;
}

Documentation

Read full documentation for the base library here: https://sandfox.dev/php/uuid.html

Also on Read the Docs: https://arokettu-uuid.readthedocs.io/

Support

Please file issues on our main repo at GitLab: https://gitlab.com/sandfox/php-uuid/-/issues

Feel free to ask any questions in our room on Gitter: https://gitter.im/arokettu/community

Both 1.x and 2.x versions are actively supported.

License

The library is available as open source under the terms of the MIT License.