src/Entity/MCQType.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\MCQTypeRepository;
  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(repositoryClassMCQTypeRepository::class)]
  9. class MCQType
  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(nullabletrue)]
  18.     private ?int $time null;
  19.     #[ORM\OneToMany(mappedBy'mCQType'targetEntityMCQQuestion::class)]
  20.     private Collection $mCQQuestions;
  21.     #[ORM\Column(nullabletrue)]
  22.     private ?int $attempts null;
  23.     #[ORM\Column(length255)]
  24.     private ?string $uri null;
  25.     #[ORM\OneToMany(mappedBy'mCQType'targetEntityMCQResult::class)]
  26.     private Collection $mCQResults;
  27.     #[ORM\Column]
  28.     private ?bool $enabled null;
  29.     #[ORM\ManyToMany(targetEntityTraining::class, inversedBy'mCQTypes')]
  30.     private Collection $trainings;
  31.     #[ORM\Column]
  32.     private ?int $questions_nb null;
  33.     #[ORM\Column]
  34.     private ?float $percent null;
  35.     #[ORM\OneToMany(mappedBy'type'targetEntityStudentResponse::class)]
  36.     private Collection $studentResponses;
  37.     #[ORM\OneToMany(mappedBy'type'targetEntityMCQQuestionsStorage::class)]
  38.     private Collection $mCQQuestionsStorages;
  39.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  40.     private ?string $description null;
  41.     public function __construct()
  42.     {
  43.         $this->mCQQuestions = new ArrayCollection();
  44.         $this->mCQResults = new ArrayCollection();
  45.         $this->trainings = new ArrayCollection();
  46.         $this->studentResponses = new ArrayCollection();
  47.         $this->mCQQuestionsStorages = new ArrayCollection();
  48.     }
  49.     public function getId(): ?int
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getName(): ?string
  54.     {
  55.         return $this->name;
  56.     }
  57.     public function setName(string $name): self
  58.     {
  59.         $this->name $name;
  60.         return $this;
  61.     }
  62.     public function getTime(): ?int
  63.     {
  64.         return $this->time;
  65.     }
  66.     public function setTime(?int $time): self
  67.     {
  68.         $this->time $time;
  69.         return $this;
  70.     }
  71.     /**
  72.      * @return Collection<int, MCQQuestion>
  73.      */
  74.     public function getMCQQuestions(): Collection
  75.     {
  76.         return $this->mCQQuestions;
  77.     }
  78.     public function addMCQQuestion(MCQQuestion $mCQQuestion): self
  79.     {
  80.         if (!$this->mCQQuestions->contains($mCQQuestion)) {
  81.             $this->mCQQuestions->add($mCQQuestion);
  82.             $mCQQuestion->setType($this);
  83.         }
  84.         return $this;
  85.     }
  86.     public function removeMCQQuestion(MCQQuestion $mCQQuestion): self
  87.     {
  88.         if ($this->mCQQuestions->removeElement($mCQQuestion)) {
  89.             // set the owning side to null (unless already changed)
  90.             if ($mCQQuestion->getType() === $this) {
  91.                 $mCQQuestion->setType(null);
  92.             }
  93.         }
  94.         return $this;
  95.     }
  96.     public function getAttempts(): ?int
  97.     {
  98.         return $this->attempts;
  99.     }
  100.     public function setAttempts(?int $attempts): self
  101.     {
  102.         $this->attempts $attempts;
  103.         return $this;
  104.     }
  105.     public function getUri(): ?string
  106.     {
  107.         return $this->uri;
  108.     }
  109.     public function setUri(string $uri): self
  110.     {
  111.         $this->uri $uri;
  112.         return $this;
  113.     }
  114.     /**
  115.      * @return Collection<int, MCQResult>
  116.      */
  117.     public function getMCQResults(): Collection
  118.     {
  119.         return $this->mCQResults;
  120.     }
  121.     public function addMCQResult(MCQResult $mCQResult): self
  122.     {
  123.         if (!$this->mCQResults->contains($mCQResult)) {
  124.             $this->mCQResults->add($mCQResult);
  125.             $mCQResult->setMCQType($this);
  126.         }
  127.         return $this;
  128.     }
  129.     public function removeMCQResult(MCQResult $mCQResult): self
  130.     {
  131.         if ($this->mCQResults->removeElement($mCQResult)) {
  132.             // set the owning side to null (unless already changed)
  133.             if ($mCQResult->getMCQType() === $this) {
  134.                 $mCQResult->setMCQType(null);
  135.             }
  136.         }
  137.         return $this;
  138.     }
  139.     public function isEnabled(): ?bool
  140.     {
  141.         return $this->enabled;
  142.     }
  143.     public function setEnabled(bool $enabled): self
  144.     {
  145.         $this->enabled $enabled;
  146.         return $this;
  147.     }
  148.     /**
  149.      * @return Collection<int, Training>
  150.      */
  151.     public function getTrainings(): Collection
  152.     {
  153.         return $this->trainings;
  154.     }
  155.     public function addTraining(Training $training): self
  156.     {
  157.         if (!$this->trainings->contains($training)) {
  158.             $this->trainings->add($training);
  159.         }
  160.         return $this;
  161.     }
  162.     public function removeTraining(Training $training): self
  163.     {
  164.         $this->trainings->removeElement($training);
  165.         return $this;
  166.     }
  167.     public function getQuestionsNb(): ?int
  168.     {
  169.         return $this->questions_nb;
  170.     }
  171.     public function setQuestionsNb(int $questions_nb): self
  172.     {
  173.         $this->questions_nb $questions_nb;
  174.         return $this;
  175.     }
  176.     public function getPercent(): ?float
  177.     {
  178.         return $this->percent;
  179.     }
  180.     public function setPercent(float $percent): self
  181.     {
  182.         $this->percent $percent;
  183.         return $this;
  184.     }
  185.     /**
  186.      * @return Collection<int, StudentResponse>
  187.      */
  188.     public function getStudentResponses(): Collection
  189.     {
  190.         return $this->studentResponses;
  191.     }
  192.     public function addStudentResponse(StudentResponse $studentResponse): self
  193.     {
  194.         if (!$this->studentResponses->contains($studentResponse)) {
  195.             $this->studentResponses->add($studentResponse);
  196.             $studentResponse->setType($this);
  197.         }
  198.         return $this;
  199.     }
  200.     public function removeStudentResponse(StudentResponse $studentResponse): self
  201.     {
  202.         if ($this->studentResponses->removeElement($studentResponse)) {
  203.             // set the owning side to null (unless already changed)
  204.             if ($studentResponse->getType() === $this) {
  205.                 $studentResponse->setType(null);
  206.             }
  207.         }
  208.         return $this;
  209.     }
  210.     /**
  211.      * @return Collection<int, MCQQuestionsStorage>
  212.      */
  213.     public function getMCQQuestionsStorages(): Collection
  214.     {
  215.         return $this->mCQQuestionsStorages;
  216.     }
  217.     public function addMCQQuestionsStorage(MCQQuestionsStorage $mCQQuestionsStorage): self
  218.     {
  219.         if (!$this->mCQQuestionsStorages->contains($mCQQuestionsStorage)) {
  220.             $this->mCQQuestionsStorages->add($mCQQuestionsStorage);
  221.             $mCQQuestionsStorage->setType($this);
  222.         }
  223.         return $this;
  224.     }
  225.     public function removeMCQQuestionsStorage(MCQQuestionsStorage $mCQQuestionsStorage): self
  226.     {
  227.         if ($this->mCQQuestionsStorages->removeElement($mCQQuestionsStorage)) {
  228.             // set the owning side to null (unless already changed)
  229.             if ($mCQQuestionsStorage->getType() === $this) {
  230.                 $mCQQuestionsStorage->setType(null);
  231.             }
  232.         }
  233.         return $this;
  234.     }
  235.     public function getDescription(): ?string
  236.     {
  237.         return $this->description;
  238.     }
  239.     public function setDescription(?string $description): self
  240.     {
  241.         $this->description $description;
  242.         return $this;
  243.     }
  244. }