for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Silverback API Component Bundle Project
*
* (c) Daniel West <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Silverback\ApiComponentBundle\Entity\Utility;
use ApiPlatform\Core\Annotation\ApiProperty;
use Doctrine\ORM\Mapping as ORM;
use Ramsey\Uuid\Uuid;
/**
* @author Daniel West <[email protected]>
* @internal
trait IdTrait
{
* @ORM\Id()
* @ORM\Column(type="string", length=36)
private string $id;
private function setId(): void
$this->id = Uuid::uuid4()->getHex()->toString();
}
* @ApiProperty(readable=false)
public function getId(): string
return $this->id;