Add assert constraints to role entity
This commit is contained in:
parent
45ae587cb1
commit
277ac8e05b
1 changed files with 6 additions and 0 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue