src/Entity/WebsiteTheme.php line 18

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\WebsiteThemeRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. #[ORM\Entity(repositoryClassWebsiteThemeRepository::class)]
  11. #[ApiResource(
  12.     normalizationContext: ['groups' => ['read']],
  13.     denormalizationContext: ['groups' => ['write']],
  14. )]
  15. class WebsiteTheme
  16. {
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column]
  20.     private ?int $id null;
  21.     #[ORM\Column(length255)]
  22.     #[Groups(["read"])]
  23.     private ?string $name null;
  24.     #[Groups(["read"])]
  25.     #[ORM\Column(length255)]
  26.     private ?string $code null;
  27.     #[Groups(["read"])]
  28.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  29.     private ?string $description null;
  30.     #[Groups(["read"])]
  31.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  32.     private ?\DateTimeInterface $createdAt null;
  33.     #[Groups(["read"])]
  34.     #[ORM\Column(length255nullabletrue)]
  35.     private ?string $image null;
  36.     #[ORM\OneToMany(mappedBy'websiteTheme'targetEntitySettings::class)]
  37.     private Collection $settings;
  38.     #[Groups(["read","write"])]
  39.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  40.     private ?string $customCss null;
  41.     #[Groups(["read","write"])]
  42.     #[ORM\Column(nullabletrue)]
  43.     private ?array $customCssPerRoutes = [];
  44.     public function __toString()
  45.     {
  46.         return $this->name
  47.     }
  48.     public function __construct()
  49.     {
  50.         $this->settings = new ArrayCollection();
  51.     }
  52.     public function getId(): ?int
  53.     {
  54.         return $this->id;
  55.     }
  56.     public function getName(): ?string
  57.     {
  58.         return $this->name;
  59.     }
  60.     public function setName(string $name): static
  61.     {
  62.         $this->name $name;
  63.         return $this;
  64.     }
  65.     public function getCode(): ?string
  66.     {
  67.         return $this->code;
  68.     }
  69.     public function setCode(string $code): static
  70.     {
  71.         $this->code $code;
  72.         return $this;
  73.     }
  74.     public function getDescription(): ?string
  75.     {
  76.         return $this->description;
  77.     }
  78.     public function setDescription(?string $description): static
  79.     {
  80.         $this->description $description;
  81.         return $this;
  82.     }
  83.     public function getCreatedAt(): ?\DateTimeInterface
  84.     {
  85.         return $this->createdAt;
  86.     }
  87.     public function setCreatedAt(?\DateTimeInterface $createdAt): static
  88.     {
  89.         $this->createdAt $createdAt;
  90.         return $this;
  91.     }
  92.     public function getImage(): ?string
  93.     {
  94.         return $this->image;
  95.     }
  96.     public function setImage(?string $image): static
  97.     {
  98.         $this->image $image;
  99.         return $this;
  100.     }
  101.     /**
  102.      * @return Collection<int, Settings>
  103.      */
  104.     public function getSettings(): Collection
  105.     {
  106.         return $this->settings;
  107.     }
  108.     public function addSetting(Settings $setting): static
  109.     {
  110.         if (!$this->settings->contains($setting)) {
  111.             $this->settings->add($setting);
  112.             $setting->setWebsiteTheme($this);
  113.         }
  114.         return $this;
  115.     }
  116.     public function removeSetting(Settings $setting): static
  117.     {
  118.         if ($this->settings->removeElement($setting)) {
  119.             // set the owning side to null (unless already changed)
  120.             if ($setting->getWebsiteTheme() === $this) {
  121.                 $setting->setWebsiteTheme(null);
  122.             }
  123.         }
  124.         return $this;
  125.     }
  126.     public function getCustomCss(): ?string
  127.     {
  128.         return $this->customCss;
  129.     }
  130.     public function setCustomCss(?string $customCss): static
  131.     {
  132.         $this->customCss $customCss;
  133.         return $this;
  134.     }
  135.     public function getCustomCssPerRoutes(): ?array
  136.     {
  137.         return $this->customCssPerRoutes;
  138.     }
  139.     public function setCustomCssPerRoutes(?array $customCssPerRoutes): static
  140.     {
  141.         $this->customCssPerRoutes $customCssPerRoutes;
  142.         return $this;
  143.     }
  144. }