diff --git a/src/Entity/Role.php b/src/Entity/Role.php index 107e7430..168b127d 100644 --- a/src/Entity/Role.php +++ b/src/Entity/Role.php @@ -4,10 +4,14 @@ namespace App\Entity; use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\ArrayCollection; +use Symfony\Component\Validator\Constraints as Assert; +use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity * @ORM\Table(name="role") + * @UniqueEntity("id") + * @UniqueEntity("name") */ class Role { @@ -16,11 +20,13 @@ class Role /** * @ORM\Id * @ORM\Column(type="string", length=80) + * @Assert\NotBlank() */ protected $id; /** * @ORM\Column(type="string", length=80) + * @Assert\NotBlank() */ protected $name;