src/Entity/FrontTheme.php line 14
<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\FrontThemeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: FrontThemeRepository::class)]
#[ApiResource]
class FrontTheme
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\OneToMany(mappedBy: 'frontTheme', targetEntity: Settings::class)]
private Collection $settings;
public function __construct()
{
$this->settings = new ArrayCollection();
}
public function __toString()
{
return (string)$this->name;
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
/**
* @return Collection<int, Settings>
*/
public function getSettings(): Collection
{
return $this->settings;
}
public function addSetting(Settings $setting): self
{
if (!$this->settings->contains($setting)) {
$this->settings->add($setting);
$setting->setFrontTheme($this);
}
return $this;
}
public function removeSetting(Settings $setting): self
{
if ($this->settings->removeElement($setting)) {
// set the owning side to null (unless already changed)
if ($setting->getFrontTheme() === $this) {
$setting->setFrontTheme(null);
}
}
return $this;
}
}