<?php
namespace App\Entity;
use App\Repository\FrontThemeRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: FrontThemeRepository::class)]
#[UniqueEntity(fields: ['name'])]
class FrontTheme
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 128)]
#[Assert\Length(max: 128)]
#[Assert\NotBlank]
#[Assert\Regex(
pattern: '/^[\p{L}\p{M}0-9\s\'-]+$/u',
)]
private ?string $name = null;
#[ORM\Column(length: 255, nullable: true)]
#[Assert\Length(max: 255)]
#[Assert\NotBlank]
private ?string $description = null;
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(nullable: true)]
private ?FileData $image = null;
public function __construct()
{
}
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 getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): static
{
$this->description = $description;
return $this;
}
public function getImage(): ?FileData
{
return $this->image;
}
public function setImage(?FileData $image): static
{
$this->image = $image;
return $this;
}
public function __toString(): string
{
return $this->name;
}
}