Add assert constraints to role entity

This commit is contained in:
Ramon Gutierrez 2018-01-10 04:41:50 +08:00
parent 45ae587cb1
commit 277ac8e05b

View file

@ -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;