src/Shared/Doctrine/Entity/Email.php line 18

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Shared\Doctrine\Entity;
  4. use App\Shared\Doctrine\Repository\EmailRepository;
  5. use Doctrine\ORM\Mapping\Column;
  6. use Doctrine\ORM\Mapping\Entity;
  7. use Doctrine\ORM\Mapping\GeneratedValue;
  8. use Doctrine\ORM\Mapping\Id;
  9. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  10. use Symfony\Component\Validator\Constraints\NotBlank;
  11. use Symfony\Component\Validator\Constraints\Regex;
  12. #[Entity(repositoryClassEmailRepository::class)]
  13. #[UniqueEntity('code')]
  14. class Email
  15. {
  16.     #[Id]
  17.     #[Column(type'integer')]
  18.     #[GeneratedValue]
  19.     private ?int $id null;
  20.     #[Column(type'string')]
  21.     #[NotBlank]
  22.     private string $name;
  23.     #[Column(type'string'uniquetrue)]
  24.     #[NotBlank]
  25.     #[Regex(pattern'/^[A-Z_]+$/')]
  26.     private string $code;
  27.     #[Column(type'text')]
  28.     #[NotBlank]
  29.     private string $body;
  30.     /**
  31.      * @var array<array-key, array{name: string, type: string}>
  32.      */
  33.     #[Column(type'json'options: ['collation' => 'utf8mb4_bin'])]
  34.     private array $parameters;
  35.     public function getId(): ?int
  36.     {
  37.         return $this->id;
  38.     }
  39.     public function getName(): string
  40.     {
  41.         return $this->name;
  42.     }
  43.     public function setName(string $name): void
  44.     {
  45.         $this->name $name;
  46.     }
  47.     public function getCode(): string
  48.     {
  49.         return $this->code;
  50.     }
  51.     public function setCode(string $code): void
  52.     {
  53.         $this->code $code;
  54.     }
  55.     public function getParameters(): array
  56.     {
  57.         return $this->parameters;
  58.     }
  59.     public function setParameters(array $parameters): void
  60.     {
  61.         $this->parameters $parameters;
  62.     }
  63.     /**
  64.      * @return string
  65.      */
  66.     public function getBody(): string
  67.     {
  68.         return $this->body;
  69.     }
  70.     /**
  71.      * @param string $body
  72.      */
  73.     public function setBody(string $body): void
  74.     {
  75.         $this->body $body;
  76.     }
  77. }