src/Entity/Thematic.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ThematicRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassThematicRepository::class)]
  9. class Thematic
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $name null;
  17.     #[ORM\Column]
  18.     private ?int $color null;
  19.     #[ORM\OneToMany(mappedBy'thematic'targetEntityQuestionnaire::class, orphanRemovaltrue)]
  20.     private Collection $questionnaires;
  21.     private ?array $availableColors null;
  22.     #[ORM\OneToMany(mappedBy'thematic'targetEntityIndicator::class)]
  23.     private Collection $indicators;
  24.     public function __construct()
  25.     {
  26.         $this->questionnaires = new ArrayCollection();
  27.         $this->indicators = new ArrayCollection();
  28.     }
  29.     public function __toString()
  30.     {
  31.         return $this->name;
  32.     }
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getName(): ?string
  38.     {
  39.         return $this->name;
  40.     }
  41.     public function setName(string $name): self
  42.     {
  43.         $this->name $name;
  44.         return $this;
  45.     }
  46.     public function getColor(): ?int
  47.     {
  48.         return $this->color;
  49.     }
  50.     public function setColor(int $color): self
  51.     {
  52.         $this->color $color;
  53.         return $this;
  54.     }
  55.     /**
  56.      * @return Collection<int, Questionnaire>
  57.      */
  58.     public function getQuestionnaires(): Collection
  59.     {
  60.         return $this->questionnaires;
  61.     }
  62.     public function addQuestionnaire(Questionnaire $questionnaire): self
  63.     {
  64.         if (!$this->questionnaires->contains($questionnaire)) {
  65.             $this->questionnaires->add($questionnaire);
  66.             $questionnaire->setThematic($this);
  67.         }
  68.         return $this;
  69.     }
  70.     public function removeQuestionnaire(Questionnaire $questionnaire): self
  71.     {
  72.         if ($this->questionnaires->removeElement($questionnaire)) {
  73.             // set the owning side to null (unless already changed)
  74.             if ($questionnaire->getThematic() === $this) {
  75.                 $questionnaire->setThematic(null);
  76.             }
  77.         }
  78.         return $this;
  79.     }
  80.     public function getAvailableColors(): ?array
  81.     {
  82.         return $this->availableColors;
  83.     }
  84.     public function setAvailableColors(array $availableColors): self
  85.     {
  86.         $this->availableColors $availableColors;
  87.         return $this;
  88.     }
  89.     /**
  90.      * @return Collection<int, Indicator>
  91.      */
  92.     public function getIndicators(): Collection
  93.     {
  94.         return $this->indicators;
  95.     }
  96.     public function addIndicator(Indicator $indicator): self
  97.     {
  98.         if (!$this->indicators->contains($indicator)) {
  99.             $this->indicators->add($indicator);
  100.             $indicator->setThematic($this);
  101.         }
  102.         return $this;
  103.     }
  104.     public function removeIndicator(Indicator $indicator): self
  105.     {
  106.         if ($this->indicators->removeElement($indicator)) {
  107.             // set the owning side to null (unless already changed)
  108.             if ($indicator->getThematic() === $this) {
  109.                 $indicator->setThematic(null);
  110.             }
  111.         }
  112.         return $this;
  113.     }
  114. }