<?php
namespace App\Entity;
use App\Repository\ThemeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ThemeRepository::class)]
class Theme
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column]
private ?int $sort = null;
#[ORM\OneToMany(mappedBy: 'theme', targetEntity: Criterion::class, orphanRemoval: true)]
private Collection $criteria;
#[ORM\ManyToMany(targetEntity: Jury::class, mappedBy: 'theme')]
private Collection $juries;
#[ORM\Column]
private ?bool $enabled = null;
#[ORM\OneToMany(mappedBy: 'theme', targetEntity: Comment::class, orphanRemoval: true)]
private Collection $comments;
private ?int $totalMax = null;
#[ORM\OneToMany(mappedBy: 'themeNotation', targetEntity: Criterion::class)]
private Collection $criteriaNotation;
#[ORM\Column(length: 64, nullable: true)]
private ?string $synthesis = null;
#[ORM\Column(length: 255)]
private ?string $code = null;
#[ORM\Column(length: 255)]
private ?string $name_en = null;
public function __construct()
{
$this->criteria = new ArrayCollection();
$this->juries = new ArrayCollection();
$this->comments = new ArrayCollection();
$this->criteriaNotation = new ArrayCollection();
}
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 getNameEn(): ?string
{
return $this->name_en;
}
public function setNameEn(string $name_en): self
{
$this->name_en = $name_en;
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getSort(): ?int
{
return $this->sort;
}
public function setSort(int $sort): self
{
$this->sort = $sort;
return $this;
}
/**
* @return Collection<int, Criterion>
*/
public function getCriteria(): Collection
{
return $this->criteria;
}
public function addCriterion(Criterion $criterion): self
{
if (!$this->criteria->contains($criterion)) {
$this->criteria->add($criterion);
$criterion->setTheme($this);
}
return $this;
}
public function removeCriterion(Criterion $criterion): self
{
if ($this->criteria->removeElement($criterion)) {
// set the owning side to null (unless already changed)
if ($criterion->getTheme() === $this) {
$criterion->setTheme(null);
}
}
return $this;
}
/**
* @return Collection<int, Jury>
*/
public function getJuries(): Collection
{
return $this->juries;
}
public function addJury(Jury $jury): self
{
if (!$this->juries->contains($jury)) {
$this->juries->add($jury);
$jury->addTheme($this);
}
return $this;
}
public function removeJury(Jury $jury): self
{
if ($this->juries->removeElement($jury)) {
$jury->removeTheme($this);
}
return $this;
}
public function isEnabled(): ?bool
{
return $this->enabled;
}
public function setEnabled(bool $enabled): self
{
$this->enabled = $enabled;
return $this;
}
/**
* @return Collection<int, Comment>
*/
public function getComments(): Collection
{
return $this->comments;
}
public function addComment(Comment $comment): self
{
if (!$this->comments->contains($comment)) {
$this->comments->add($comment);
$comment->setTheme($this);
}
return $this;
}
public function removeComment(Comment $comment): self
{
if ($this->comments->removeElement($comment)) {
// set the owning side to null (unless already changed)
if ($comment->getTheme() === $this) {
$comment->setTheme(null);
}
}
return $this;
}
public function getTotalMax(): ?int
{
return $this->totalMax;
}
public function setTotalMax(int $totalMax): self
{
$this->totalMax = $totalMax;
return $this;
}
/**
* @return Collection<int, Criterion>
*/
public function getCriteriaNotation(): Collection
{
return $this->criteriaNotation;
}
public function addCriteriaNotation(Criterion $criteriaNotation): self
{
if (!$this->criteriaNotation->contains($criteriaNotation)) {
$this->criteriaNotation->add($criteriaNotation);
$criteriaNotation->setThemeNotation($this);
}
return $this;
}
public function removeCriteriaNotation(Criterion $criteriaNotation): self
{
if ($this->criteriaNotation->removeElement($criteriaNotation)) {
// set the owning side to null (unless already changed)
if ($criteriaNotation->getThemeNotation() === $this) {
$criteriaNotation->setThemeNotation(null);
}
}
return $this;
}
public function getSynthesis(): ?string
{
return $this->synthesis;
}
public function setSynthesis(?string $synthesis): self
{
$this->synthesis = $synthesis;
return $this;
}
}