src/Entity/FrontTheme.php line 14

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\FrontThemeRepository;
  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. #[ORM\Entity(repositoryClassFrontThemeRepository::class)]
  10. #[ApiResource]
  11. class FrontTheme
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $name null;
  19.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  20.     private ?string $description null;
  21.     #[ORM\OneToMany(mappedBy'frontTheme'targetEntitySettings::class)]
  22.     private Collection $settings;
  23.     public function __construct()
  24.     {
  25.         $this->settings = new ArrayCollection();
  26.     }
  27.     public function __toString()
  28.     {
  29.         return (string)$this->name;
  30.     }
  31.     public function getId(): ?int
  32.     {
  33.         return $this->id;
  34.     }
  35.     public function getName(): ?string
  36.     {
  37.         return $this->name;
  38.     }
  39.     public function setName(string $name): self
  40.     {
  41.         $this->name $name;
  42.         return $this;
  43.     }
  44.     public function getDescription(): ?string
  45.     {
  46.         return $this->description;
  47.     }
  48.     public function setDescription(?string $description): self
  49.     {
  50.         $this->description $description;
  51.         return $this;
  52.     }
  53.     /**
  54.      * @return Collection<int, Settings>
  55.      */
  56.     public function getSettings(): Collection
  57.     {
  58.         return $this->settings;
  59.     }
  60.     public function addSetting(Settings $setting): self
  61.     {
  62.         if (!$this->settings->contains($setting)) {
  63.             $this->settings->add($setting);
  64.             $setting->setFrontTheme($this);
  65.         }
  66.         return $this;
  67.     }
  68.     public function removeSetting(Settings $setting): self
  69.     {
  70.         if ($this->settings->removeElement($setting)) {
  71.             // set the owning side to null (unless already changed)
  72.             if ($setting->getFrontTheme() === $this) {
  73.                 $setting->setFrontTheme(null);
  74.             }
  75.         }
  76.         return $this;
  77.     }
  78. }