PHP code example of arokettu / uuid-doctrine

1. Go to this page and download the library: Download arokettu/uuid-doctrine library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

arokettu / uuid-doctrine example snippets




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