<?php
namespace App\Entity;
use App\Repository\RolesRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass=RolesRepository::class)
* @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(columns={"name"})})
* @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(columns={"code"})})
*/
class Roles
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, unique=true)
* @Assert\NotBlank(message="Le nom du rôle est obligatoire")
*/
private $name;
/**
* @ORM\Column(type="string", length=255, unique=true)
* @Assert\NotBlank(message="Le code du rôle est obligatoire")
*/
private $code;
/**
* @ORM\Column(type="boolean")
*/
private $status = true;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function isStatus(): ?bool
{
return $this->status;
}
public function setStatus(bool $status): self
{
$this->status = $status;
return $this;
}
function __toString()
{
return $this->getName();
}
}