<?php
namespace App\Entity;
use App\Repository\QuizRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use JMS\Serializer\Annotation as Serializer;
/**
* @ORM\Entity(repositoryClass=QuizRepository::class)
* @Serializer\ExclusionPolicy("ALL")
*/
class Quiz extends BaseEntity
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Serializer\Expose
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Serializer\Expose
*/
private $title;
/**
* @ORM\Column(type="text", nullable=true)
* @Serializer\Expose
*/
private $description;
/**
* @ORM\OneToOne(targetEntity=ImageManager::class, cascade={"persist", "remove"})
* @Serializer\Expose
*/
private $background;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $timeLimit = 'aucun';
/**
* @ORM\Column(type="datetime", nullable=true)
* @Serializer\Expose
*/
private $startAt;
/**
* @ORM\Column(type="datetime", nullable=true)
* @Serializer\Expose
*/
private $endAt;
/**
* @ORM\Column(type="boolean")
* @Serializer\Expose
*/
private $isDisplayCorrectAnswerAutomatically = false;
/**
* @ORM\Column(type="boolean")
* @Serializer\Expose
*/
private $isQuestionRandomDisplay = false;
/**
* @ORM\Column(type="boolean")
* @Serializer\Expose
*/
private $isNotifyParticipant = false;
/**
* @ORM\Column(type="boolean")
* @Serializer\Expose
*/
private $isReplayPossible = false;
/**
* @ORM\Column(type="string", length=255)
*/
private $status = 'draft';
/**
* @ORM\OneToMany(targetEntity=QuizQuestion::class, mappedBy="quiz", cascade={"persist", "remove"}, fetch="EXTRA_LAZY")
* @Serializer\Expose
*/
private $quizQuestions;
/**
* @ORM\Column(type="time", nullable=true)
* @Serializer\Expose
*/
private $time;
/**
* @ORM\OneToMany(targetEntity=ModuleItem::class, mappedBy="quiz", cascade={"persist", "remove"}, fetch="EXTRA_LAZY")
*/
private $moduleItems;
/**
* @ORM\OneToMany(targetEntity=ModuleParticipation::class, mappedBy="quiz", cascade={"persist", "remove"}, fetch="EXTRA_LAZY")
*/
private $moduleParticipations;
/**
* @Gedmo\Slug(fields={"title"})
* @ORM\Column(length=191)
*/
private $slug;
/**
* @ORM\Column(type="decimal", precision=10, scale=0, nullable=true)
*/
private $minValidationScore;
/**
* @ORM\OneToMany(targetEntity=QuizCertificate::class, mappedBy="quiz", cascade={"persist", "remove"}, fetch="EXTRA_LAZY")
*/
private $certificates;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isPublished = false;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $rejectReason;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $currentPlace;
/**
* @ORM\ManyToMany(targetEntity=Module::class, inversedBy="quiz")
*/
private $modules;
/**
* @ORM\OneToMany(targetEntity=QuizView::class, mappedBy="quiz", orphanRemoval=true, fetch="EXTRA_LAZY")
*/
private $quizViews;
/**
* @ORM\Column(type="string", length=1000000, nullable=true)
*/
private $reviewReason;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $startingNotificationSent = false;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $endingNotificationSent;
public function __construct()
{
$this->quizQuestions = new ArrayCollection();
$this->moduleItems = new ArrayCollection();
$this->moduleParticipations = new ArrayCollection();
$this->certificates = new ArrayCollection();
$this->modules = new ArrayCollection();
$this->quizViews = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getBackground(): ?ImageManager
{
return $this->background;
}
public function setBackground(?ImageManager $background): self
{
$this->background = $background;
return $this;
}
public function getTimeLimit(): ?string
{
return $this->timeLimit;
}
public function setTimeLimit(?string $timeLimit): self
{
$this->timeLimit = $timeLimit;
return $this;
}
public function getStartAt(): ?\DateTimeInterface
{
return $this->startAt;
}
public function setStartAt(?\DateTimeInterface $startAt): self
{
$this->startAt = $startAt;
return $this;
}
public function getEndAt(): ?\DateTimeInterface
{
return $this->endAt;
}
public function setEndAt(?\DateTimeInterface $endAt): self
{
$this->endAt = $endAt;
return $this;
}
public function isIsDisplayCorrectAnswerAutomatically(): ?bool
{
return $this->isDisplayCorrectAnswerAutomatically;
}
public function setIsDisplayCorrectAnswerAutomatically(bool $isDisplayCorrectAnswerAutomatically): self
{
$this->isDisplayCorrectAnswerAutomatically = $isDisplayCorrectAnswerAutomatically;
return $this;
}
public function isIsQuestionRandomDisplay(): ?bool
{
return $this->isQuestionRandomDisplay;
}
public function setIsQuestionRandomDisplay(bool $isQuestionRandomDisplay): self
{
$this->isQuestionRandomDisplay = $isQuestionRandomDisplay;
return $this;
}
public function isIsNotifyParticipant(): ?bool
{
return $this->isNotifyParticipant;
}
public function setIsNotifyParticipant(bool $isNotifyParticipant): self
{
$this->isNotifyParticipant = $isNotifyParticipant;
return $this;
}
public function isIsReplayPossible(): ?bool
{
return $this->isReplayPossible;
}
public function setIsReplayPossible(bool $isReplayPossible): self
{
$this->isReplayPossible = $isReplayPossible;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(string $status): self
{
$this->status = $status;
return $this;
}
/**
* @return Collection<int, QuizQuestion>
*/
public function getQuizQuestions(): Collection
{
return $this->quizQuestions;
}
public function addQuizQuestion(QuizQuestion $quizQuestion): self
{
if (!$this->quizQuestions->contains($quizQuestion)) {
$this->quizQuestions[] = $quizQuestion;
$quizQuestion->setQuiz($this);
}
return $this;
}
public function removeQuizQuestion(QuizQuestion $quizQuestion): self
{
if ($this->quizQuestions->removeElement($quizQuestion)) {
// set the owning side to null (unless already changed)
if ($quizQuestion->getQuiz() === $this) {
$quizQuestion->setQuiz(null);
}
}
return $this;
}
public function getTime(): ?\DateTimeInterface
{
return $this->time;
}
public function setTime(?\DateTimeInterface $time): self
{
$this->time = $time;
return $this;
}
/**
* @return Collection<int, ModuleItem>
*/
public function getModuleItems(): Collection
{
return $this->moduleItems;
}
public function addModuleItem(ModuleItem $moduleItem): self
{
if (!$this->moduleItems->contains($moduleItem)) {
$this->moduleItems[] = $moduleItem;
$moduleItem->setQuiz($this);
}
return $this;
}
public function removeModuleItem(ModuleItem $moduleItem): self
{
if ($this->moduleItems->removeElement($moduleItem)) {
// set the owning side to null (unless already changed)
if ($moduleItem->getQuiz() === $this) {
$moduleItem->setQuiz(null);
}
}
return $this;
}
/**
* @return Collection<int, ModuleParticipation>
*/
public function getModuleParticipations(): Collection
{
return $this->moduleParticipations;
}
public function addModuleParticipation(ModuleParticipation $moduleParticipation): self
{
if (!$this->moduleParticipations->contains($moduleParticipation)) {
$this->moduleParticipations[] = $moduleParticipation;
$moduleParticipation->setQuiz($this);
}
return $this;
}
public function removeModuleParticipation(ModuleParticipation $moduleParticipation): self
{
if ($this->moduleParticipations->removeElement($moduleParticipation)) {
// set the owning side to null (unless already changed)
if ($moduleParticipation->getQuiz() === $this) {
$moduleParticipation->setQuiz(null);
}
}
return $this;
}
/**
* Get the value of slug
*/
public function getSlug()
{
return $this->slug;
}
/**
* Set the value of slug
*
* @return self
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
public function getMinValidationScore(): ?string
{
return $this->minValidationScore;
}
public function setMinValidationScore(?string $minValidationScore): self
{
$this->minValidationScore = $minValidationScore;
return $this;
}
/**
* @return Collection<int, QuizCertificate>
*/
public function getCertificates(): Collection
{
return $this->certificates;
}
public function addCertificate(QuizCertificate $certificate): self
{
if (!$this->certificates->contains($certificate)) {
$this->certificates[] = $certificate;
$certificate->setQuiz($this);
}
return $this;
}
public function removeCertificate(QuizCertificate $certificate): self
{
if ($this->certificates->removeElement($certificate)) {
// set the owning side to null (unless already changed)
if ($certificate->getQuiz() === $this) {
$certificate->setQuiz(null);
}
}
return $this;
}
public function isIsPublished(): ?bool
{
return $this->isPublished;
}
public function setIsPublished(?bool $isPublished): self
{
$this->isPublished = $isPublished;
return $this;
}
public function getRejectReason(): ?string
{
return $this->rejectReason;
}
public function setRejectReason(?string $rejectReason): self
{
$this->rejectReason = $rejectReason;
return $this;
}
public function getCurrentPlace(): ?string
{
return $this->currentPlace;
}
public function setCurrentPlace(?string $currentPlace): self
{
$this->currentPlace = $currentPlace;
return $this;
}
/**
* @return Collection<int, Module>
*/
public function getModules(): Collection
{
return $this->modules;
}
public function addModule(Module $module): self
{
if (!$this->modules->contains($module)) {
$this->modules[] = $module;
}
return $this;
}
public function removeModule(Module $module): self
{
$this->modules->removeElement($module);
return $this;
}
/**
* @return Collection<int, QuizView>
*/
public function getQuizViews(): Collection
{
return $this->quizViews;
}
public function addQuizView(QuizView $quizView): self
{
if (!$this->quizViews->contains($quizView)) {
$this->quizViews[] = $quizView;
$quizView->setQuiz($this);
}
return $this;
}
public function removeQuizView(QuizView $quizView): self
{
if ($this->quizViews->removeElement($quizView)) {
// set the owning side to null (unless already changed)
if ($quizView->getQuiz() === $this) {
$quizView->setQuiz(null);
}
}
return $this;
}
public function getReviewReason(): ?string
{
return $this->reviewReason;
}
public function setReviewReason(?string $reviewReason): self
{
$this->reviewReason = $reviewReason;
return $this;
}
public function isStartingNotificationSent(): ?bool
{
return $this->startingNotificationSent;
}
public function setStartingNotificationSent(?bool $startingNotificationSent): self
{
$this->startingNotificationSent = $startingNotificationSent;
return $this;
}
public function isEndingNotificationSent(): ?bool
{
return $this->endingNotificationSent;
}
public function setEndingNotificationSent(?bool $endingNotificationSent): self
{
$this->endingNotificationSent = $endingNotificationSent;
return $this;
}
}