src/Entity/Thematic.php line 12
<?php
namespace App\Entity;
use App\Repository\ThematicRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ThematicRepository::class)]
class Thematic
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column]
private ?int $color = null;
#[ORM\OneToMany(mappedBy: 'thematic', targetEntity: Questionnaire::class, orphanRemoval: true)]
private Collection $questionnaires;
private ?array $availableColors = null;
#[ORM\OneToMany(mappedBy: 'thematic', targetEntity: Indicator::class)]
private Collection $indicators;
public function __construct()
{
$this->questionnaires = new ArrayCollection();
$this->indicators = new ArrayCollection();
}
public function __toString()
{
return $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 getColor(): ?int
{
return $this->color;
}
public function setColor(int $color): self
{
$this->color = $color;
return $this;
}
/**
* @return Collection<int, Questionnaire>
*/
public function getQuestionnaires(): Collection
{
return $this->questionnaires;
}
public function addQuestionnaire(Questionnaire $questionnaire): self
{
if (!$this->questionnaires->contains($questionnaire)) {
$this->questionnaires->add($questionnaire);
$questionnaire->setThematic($this);
}
return $this;
}
public function removeQuestionnaire(Questionnaire $questionnaire): self
{
if ($this->questionnaires->removeElement($questionnaire)) {
// set the owning side to null (unless already changed)
if ($questionnaire->getThematic() === $this) {
$questionnaire->setThematic(null);
}
}
return $this;
}
public function getAvailableColors(): ?array
{
return $this->availableColors;
}
public function setAvailableColors(array $availableColors): self
{
$this->availableColors = $availableColors;
return $this;
}
/**
* @return Collection<int, Indicator>
*/
public function getIndicators(): Collection
{
return $this->indicators;
}
public function addIndicator(Indicator $indicator): self
{
if (!$this->indicators->contains($indicator)) {
$this->indicators->add($indicator);
$indicator->setThematic($this);
}
return $this;
}
public function removeIndicator(Indicator $indicator): self
{
if ($this->indicators->removeElement($indicator)) {
// set the owning side to null (unless already changed)
if ($indicator->getThematic() === $this) {
$indicator->setThematic(null);
}
}
return $this;
}
}