src/Entity/Qcm.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\QcmRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassQcmRepository::class)]
  8. #[ORM\HasLifecycleCallbacks]
  9. class Qcm
  10. {
  11.     use \App\Traits\EntityDateTimeAbleTrait;
  12.     
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column(type'integer')]
  16.     private $id;
  17.     #[ORM\Column(type'string'length255nullabletrue)]
  18.     private ?string $name null;
  19.     #[ORM\OneToMany(targetEntityQcmQuestion::class, mappedBy'qcm')]
  20.     private Collection $qcmQuestions;
  21.     #[ORM\OneToMany(targetEntityProfileQcm::class, mappedBy'qcm')]
  22.     private Collection $profileQcms;
  23.     #[ORM\Column(type'integer'nullabletrue)]
  24.     private ?int $times null;
  25.     #[ORM\ManyToMany(targetEntityProgram::class, mappedBy'qcm')]
  26.     private Collection $programs;
  27.     public function __construct()
  28.     {
  29.         $this->qcmQuestions = new ArrayCollection();
  30.         $this->profileQcms = new ArrayCollection();
  31.         $this->programs = new ArrayCollection();
  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.     /**
  47.      * @return Collection<int, QcmQuestion>
  48.      */
  49.     public function getQcmQuestions(): Collection
  50.     {
  51.         return $this->qcmQuestions;
  52.     }
  53.     public function addQcmQuestion(QcmQuestion $qcmQuestion): self
  54.     {
  55.         if (!$this->qcmQuestions->contains($qcmQuestion)) {
  56.             $this->qcmQuestions[] = $qcmQuestion;
  57.             $qcmQuestion->setQcm($this);
  58.         }
  59.         return $this;
  60.     }
  61.     public function removeQcmQuestion(QcmQuestion $qcmQuestion): self
  62.     {
  63.         if ($this->qcmQuestions->removeElement($qcmQuestion)) {
  64.             // set the owning side to null (unless already changed)
  65.             if ($qcmQuestion->getQcm() === $this) {
  66.                 $qcmQuestion->setQcm(null);
  67.             }
  68.         }
  69.         return $this;
  70.     }
  71.     /**
  72.      * @return Collection<int, ProfileQcm>
  73.      */
  74.     public function getProfileQcms(): Collection
  75.     {
  76.         return $this->profileQcms;
  77.     }
  78.     public function addProfileQcm(ProfileQcm $profileQcm): self
  79.     {
  80.         if (!$this->profileQcms->contains($profileQcm)) {
  81.             $this->profileQcms[] = $profileQcm;
  82.             $profileQcm->setQcm($this);
  83.         }
  84.         return $this;
  85.     }
  86.     public function removeProfileQcm(ProfileQcm $profileQcm): self
  87.     {
  88.         if ($this->profileQcms->removeElement($profileQcm)) {
  89.             // set the owning side to null (unless already changed)
  90.             if ($profileQcm->getQcm() === $this) {
  91.                 $profileQcm->setQcm(null);
  92.             }
  93.         }
  94.         return $this;
  95.     }
  96.     public function getTimes(): ?int
  97.     {
  98.         return $this->times;
  99.     }
  100.     public function setTimes(?int $times): self
  101.     {
  102.         $this->times $times;
  103.         return $this;
  104.     }
  105.     /**
  106.      * @return Collection<int, Program>
  107.      */
  108.     public function getPrograms(): Collection
  109.     {
  110.         return $this->programs;
  111.     }
  112.     public function addProgram(Program $program): self
  113.     {
  114.         if (!$this->programs->contains($program)) {
  115.             $this->programs[] = $program;
  116.             $program->addQcm($this);
  117.         }
  118.         return $this;
  119.     }
  120.     public function removeProgram(Program $program): self
  121.     {
  122.         if ($this->programs->removeElement($program)) {
  123.             $program->removeQcm($this);
  124.         }
  125.         return $this;
  126.     }
  127. }