From 0179a1b87ecd7cff8393420316cbf63e8bf1390f Mon Sep 17 00:00:00 2001 From: Ramon Gutierrez Date: Wed, 2 Oct 2024 13:58:03 +0800 Subject: [PATCH] Validate role ID and name are not blank #808 --- src/Entity/Role.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Entity/Role.php b/src/Entity/Role.php index 38fcc0b2..f90efd39 100644 --- a/src/Entity/Role.php +++ b/src/Entity/Role.php @@ -6,6 +6,7 @@ use Catalyst\AuthBundle\Entity\Role as BaseRole; 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; /** @@ -16,6 +17,19 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; */ class Role extends BaseRole { + /** + * @ORM\Id + * @ORM\Column(type="string", length=80) + * @Assert\NotBlank() + */ + protected $id; + + /** + * @ORM\Column(type="string", length=80) + * @Assert\NotBlank() + */ + protected $name; + /** * @ORM\ManyToMany(targetEntity="User", mappedBy="roles", fetch="EXTRA_LAZY") */