Skip to content

Instantly share code, notes, and snippets.

@parijke
Created August 20, 2020 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parijke/9b3086c088f605d2a1b0bafe1572d6ea to your computer and use it in GitHub Desktop.
Save parijke/9b3086c088f605d2a1b0bafe1572d6ea to your computer and use it in GitHub Desktop.
Use the EntityIdTrait
<?php
namespace App\Entity;
use App\Entity\Traits\EntityIdTrait;
use App\Repository\TestRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=TestRepository::class)
*/
class Test
{
use EntityIdTrait;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $name;
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment