src/Entity/Action.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ActionRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ActionRepository::class)
  9.  * @ORM\Table(name="action", uniqueConstraints={@ORM\UniqueConstraint(columns={"code"})})
  10.  * @UniqueEntity(fields={"code"}, message="Le code de l'action doit ĂȘtre unique")
  11.  */
  12. class Action
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private ?int $id null;
  20.     /**
  21.      * Code logique: CREATE, READ, UPDATE, DELETE, ACTIVER
  22.      * @ORM\Column(type="string", length=50, unique=true)
  23.      * @Assert\NotBlank(message="Le code de l'action est obligatoire")
  24.      */
  25.     private ?string $code null;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private ?string $description null;
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getCode(): ?string
  35.     {
  36.         return $this->code;
  37.     }
  38.     public function setCode(string $code): self
  39.     {
  40.         $this->code $code;
  41.         return $this;
  42.     }
  43.     public function getDescription(): ?string
  44.     {
  45.         return $this->description;
  46.     }
  47.     public function setDescription(?string $description): self
  48.     {
  49.         $this->description $description;
  50.         return $this;
  51.     }
  52.     public function __toString(): string
  53.     {
  54.         return $this->code ?? 'action';
  55.     }
  56. }