PHP code example of kiefernwald / doctrine-uuid-generator

1. Go to this page and download the library: Download kiefernwald/doctrine-uuid-generator 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/ */

    

kiefernwald / doctrine-uuid-generator example snippets




// ...

use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\CustomIdGenerator;

/**
 * Class MyAwesomeEntity
 *
 * @Entity
 * ...
 */
class MyAwesomeEntity
{
    /**
     * @var string $uuid
     * @Column(name="uuid", type="string")
     * @Id
     * @GeneratedValue(strategy="CUSTOM")
     * @CustomIdGenerator(class="Kiefernwald\DoctrineUuid\Doctrine\ORM\UuidGenerator")
     */
    protected $uuid;

    // ...
}