<?php
namespace App\Entity;
use App\Repository\MCQTypeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MCQTypeRepository::class)]
class MCQType
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(nullable: true)]
private ?int $time = null;
#[ORM\OneToMany(mappedBy: 'mCQType', targetEntity: MCQQuestion::class)]
private Collection $mCQQuestions;
#[ORM\Column(nullable: true)]
private ?int $attempts = null;
#[ORM\Column(length: 255)]
private ?string $uri = null;
#[ORM\OneToMany(mappedBy: 'mCQType', targetEntity: MCQResult::class)]
private Collection $mCQResults;
#[ORM\Column]
private ?bool $enabled = null;
#[ORM\ManyToMany(targetEntity: Training::class, inversedBy: 'mCQTypes')]
private Collection $trainings;
#[ORM\Column]
private ?int $questions_nb = null;
#[ORM\Column]
private ?float $percent = null;
#[ORM\OneToMany(mappedBy: 'type', targetEntity: StudentResponse::class)]
private Collection $studentResponses;
#[ORM\OneToMany(mappedBy: 'type', targetEntity: MCQQuestionsStorage::class)]
private Collection $mCQQuestionsStorages;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
public function __construct()
{
$this->mCQQuestions = new ArrayCollection();
$this->mCQResults = new ArrayCollection();
$this->trainings = new ArrayCollection();
$this->studentResponses = new ArrayCollection();
$this->mCQQuestionsStorages = 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 getTime(): ?int
{
return $this->time;
}
public function setTime(?int $time): self
{
$this->time = $time;
return $this;
}
/**
* @return Collection<int, MCQQuestion>
*/
public function getMCQQuestions(): Collection
{
return $this->mCQQuestions;
}
public function addMCQQuestion(MCQQuestion $mCQQuestion): self
{
if (!$this->mCQQuestions->contains($mCQQuestion)) {
$this->mCQQuestions->add($mCQQuestion);
$mCQQuestion->setType($this);
}
return $this;
}
public function removeMCQQuestion(MCQQuestion $mCQQuestion): self
{
if ($this->mCQQuestions->removeElement($mCQQuestion)) {
// set the owning side to null (unless already changed)
if ($mCQQuestion->getType() === $this) {
$mCQQuestion->setType(null);
}
}
return $this;
}
public function getAttempts(): ?int
{
return $this->attempts;
}
public function setAttempts(?int $attempts): self
{
$this->attempts = $attempts;
return $this;
}
public function getUri(): ?string
{
return $this->uri;
}
public function setUri(string $uri): self
{
$this->uri = $uri;
return $this;
}
/**
* @return Collection<int, MCQResult>
*/
public function getMCQResults(): Collection
{
return $this->mCQResults;
}
public function addMCQResult(MCQResult $mCQResult): self
{
if (!$this->mCQResults->contains($mCQResult)) {
$this->mCQResults->add($mCQResult);
$mCQResult->setMCQType($this);
}
return $this;
}
public function removeMCQResult(MCQResult $mCQResult): self
{
if ($this->mCQResults->removeElement($mCQResult)) {
// set the owning side to null (unless already changed)
if ($mCQResult->getMCQType() === $this) {
$mCQResult->setMCQType(null);
}
}
return $this;
}
public function isEnabled(): ?bool
{
return $this->enabled;
}
public function setEnabled(bool $enabled): self
{
$this->enabled = $enabled;
return $this;
}
/**
* @return Collection<int, Training>
*/
public function getTrainings(): Collection
{
return $this->trainings;
}
public function addTraining(Training $training): self
{
if (!$this->trainings->contains($training)) {
$this->trainings->add($training);
}
return $this;
}
public function removeTraining(Training $training): self
{
$this->trainings->removeElement($training);
return $this;
}
public function getQuestionsNb(): ?int
{
return $this->questions_nb;
}
public function setQuestionsNb(int $questions_nb): self
{
$this->questions_nb = $questions_nb;
return $this;
}
public function getPercent(): ?float
{
return $this->percent;
}
public function setPercent(float $percent): self
{
$this->percent = $percent;
return $this;
}
/**
* @return Collection<int, StudentResponse>
*/
public function getStudentResponses(): Collection
{
return $this->studentResponses;
}
public function addStudentResponse(StudentResponse $studentResponse): self
{
if (!$this->studentResponses->contains($studentResponse)) {
$this->studentResponses->add($studentResponse);
$studentResponse->setType($this);
}
return $this;
}
public function removeStudentResponse(StudentResponse $studentResponse): self
{
if ($this->studentResponses->removeElement($studentResponse)) {
// set the owning side to null (unless already changed)
if ($studentResponse->getType() === $this) {
$studentResponse->setType(null);
}
}
return $this;
}
/**
* @return Collection<int, MCQQuestionsStorage>
*/
public function getMCQQuestionsStorages(): Collection
{
return $this->mCQQuestionsStorages;
}
public function addMCQQuestionsStorage(MCQQuestionsStorage $mCQQuestionsStorage): self
{
if (!$this->mCQQuestionsStorages->contains($mCQQuestionsStorage)) {
$this->mCQQuestionsStorages->add($mCQQuestionsStorage);
$mCQQuestionsStorage->setType($this);
}
return $this;
}
public function removeMCQQuestionsStorage(MCQQuestionsStorage $mCQQuestionsStorage): self
{
if ($this->mCQQuestionsStorages->removeElement($mCQQuestionsStorage)) {
// set the owning side to null (unless already changed)
if ($mCQQuestionsStorage->getType() === $this) {
$mCQQuestionsStorage->setType(null);
}
}
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
}