<?php
namespace App\Entity;
use DateTimeInterface;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\Actuv2QuizRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* Actuv2Quiz
*
* @Vich\Uploadable
*/
#[ORM\Table(name: 'actuv2_quiz')]
#[ORM\Entity(repositoryClass: Actuv2QuizRepository::class)]
class Actuv2Quiz
{
/**
* @var int
*
*/
#[ORM\Column(name: 'id', type: 'bigint', nullable: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private $id;
#[ORM\Column(name: 'date', type: 'date', nullable: true, options: ['comment' => 'période'])]
private $date;
#[ORM\Column(name: 'question', type: 'text', nullable: false)]
private $question;
#[ORM\Column(name: 'detail', type: 'text', nullable: false)]
private $detail;
#[ORM\OneToMany(targetEntity: Actuv2QuizAnswer::class, mappedBy: 'quiz', orphanRemoval: true, cascade: ['persist', 'remove'])]
private $answers;
#[ORM\Column(type: 'datetime', nullable: true)]
private $updatedAt;
public function __construct()
{
$this->answers = new ArrayCollection();
}
public function getId(): ?string
{
return $this->id;
}
public function getDate(): ?DateTimeInterface
{
return $this->date;
}
public function setDate(?\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getQuestion(): ?string
{
return $this->question;
}
public function setQuestion(?string $question): self
{
$this->question = $question;
return $this;
}
public function getDetail(): ?string
{
return $this->detail;
}
public function setDetail(?string $detail): self
{
$this->detail = $detail;
return $this;
}
/**
* @return Collection|Actuv2QuizAnswer[]
*/
public function getAnswers(): ?Collection
{
return $this->answers;
}
public function addAnswers(Actuv2QuizAnswer $answers): self
{
if (!$this->answers->contains($answers)) {
$this->answers[] = $answers;
$answers->setQuiz($this);
}
return $this;
}
public function removeAnswers(Actuv2QuizAnswer $answers): self
{
if ($this->answers->removeElement($answers)) {
if ($answers->getQuiz() === $this) {
$answers->setQuiz(null);
}
}
return $this;
}
}