src/Entity/FrontTheme.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FrontThemeRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. #[ORM\Entity(repositoryClassFrontThemeRepository::class)]
  8. #[UniqueEntity(fields: ['name'])]
  9. class FrontTheme
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length128)]
  16.     #[Assert\Length(max128)]
  17.     #[Assert\NotBlank]
  18.     #[Assert\Regex(
  19.         pattern'/^[\p{L}\p{M}0-9\s\'-]+$/u',
  20.     )]
  21.     private ?string $name null;
  22.     #[ORM\Column(length255nullabletrue)]
  23.     #[Assert\Length(max255)]
  24.     #[Assert\NotBlank]
  25.     private ?string $description null;
  26.     #[ORM\OneToOne(cascade: ['persist''remove'])]
  27.     #[ORM\JoinColumn(nullabletrue)]
  28.     private ?FileData $image null;
  29.     public function __construct()
  30.     {
  31.     }
  32.     public function getId(): ?int
  33.     {
  34.         return $this->id;
  35.     }
  36.     public function getName(): ?string
  37.     {
  38.         return $this->name;
  39.     }
  40.     public function setName(string $name): static
  41.     {
  42.         $this->name $name;
  43.         return $this;
  44.     }
  45.     public function getDescription(): ?string
  46.     {
  47.         return $this->description;
  48.     }
  49.     public function setDescription(?string $description): static
  50.     {
  51.         $this->description $description;
  52.         return $this;
  53.     }
  54.     public function getImage(): ?FileData
  55.     {
  56.         return $this->image;
  57.     }
  58.     public function setImage(?FileData $image): static
  59.     {
  60.         $this->image $image;
  61.         return $this;
  62.     }
  63.     public function __toString(): string
  64.     {
  65.         return $this->name;
  66.     }
  67. }