for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the TheAlternativeZurich/events project.
*
* (c) Florian Moser <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Entity\Traits;
use Doctrine\ORM\Mapping as ORM;
* the id used in the entities
trait IdTrait
{
/**
* @var string|null
* will be null when not inserted into the db yet
* @ORM\Id
* @ORM\Column(name="id", type="guid")
* @ORM\GeneratedValue(strategy="UUID")
private $id;
public function getId(): ?string
return $this->id;
}
public function setId(string $id): void
$this->id = $id;
public function isPersistedInDatabase(): bool
return null !== $this->id;