src/Entity/WebsiteTheme.php line 18
<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\WebsiteThemeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
#[ORM\Entity(repositoryClass: WebsiteThemeRepository::class)]
#[ApiResource(
normalizationContext: ['groups' => ['read']],
denormalizationContext: ['groups' => ['write']],
)]
class WebsiteTheme
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
#[Groups(["read"])]
private ?string $name = null;
#[Groups(["read"])]
#[ORM\Column(length: 255)]
private ?string $code = null;
#[Groups(["read"])]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[Groups(["read"])]
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $createdAt = null;
#[Groups(["read"])]
#[ORM\Column(length: 255, nullable: true)]
private ?string $image = null;
#[ORM\OneToMany(mappedBy: 'websiteTheme', targetEntity: Settings::class)]
private Collection $settings;
#[Groups(["read","write"])]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $customCss = null;
#[Groups(["read","write"])]
#[ORM\Column(nullable: true)]
private ?array $customCssPerRoutes = [];
public function __toString()
{
return $this->name;
}
public function __construct()
{
$this->settings = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): static
{
$this->code = $code;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): static
{
$this->description = $description;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): static
{
$this->createdAt = $createdAt;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): static
{
$this->image = $image;
return $this;
}
/**
* @return Collection<int, Settings>
*/
public function getSettings(): Collection
{
return $this->settings;
}
public function addSetting(Settings $setting): static
{
if (!$this->settings->contains($setting)) {
$this->settings->add($setting);
$setting->setWebsiteTheme($this);
}
return $this;
}
public function removeSetting(Settings $setting): static
{
if ($this->settings->removeElement($setting)) {
// set the owning side to null (unless already changed)
if ($setting->getWebsiteTheme() === $this) {
$setting->setWebsiteTheme(null);
}
}
return $this;
}
public function getCustomCss(): ?string
{
return $this->customCss;
}
public function setCustomCss(?string $customCss): static
{
$this->customCss = $customCss;
return $this;
}
public function getCustomCssPerRoutes(): ?array
{
return $this->customCssPerRoutes;
}
public function setCustomCssPerRoutes(?array $customCssPerRoutes): static
{
$this->customCssPerRoutes = $customCssPerRoutes;
return $this;
}
}