<?php namespace App\Entity; use App\Repository\QuizzQuestionRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity(repositoryClass=QuizzQuestionRepository::class) */ class QuizzQuestion { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $title; /** * @ORM\Column(type="text", nullable=true) */ private $content; /** * @ORM\OneToMany(targetEntity=QuizzResponse::class, mappedBy="quizzQuestion", orphanRemoval=true) */ private $position; /** * @ORM\ManyToOne(targetEntity=Quizz::class, inversedBy="questions") * @ORM\JoinColumn(nullable=false) */ private $quizz; public function __construct() { $this->position = 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 getContent(): ?string { return $this->content; } public function setContent( ?string $content ): self { $this->content = $content; return $this; } /** * @return Collection<int, QuizzResponse> */ public function getPosition(): Collection { return $this->position; } public function addPosition( QuizzResponse $position ): self { if ( !$this->position->contains( $position ) ) { $this->position[] = $position; $position->setQuizzQuestion( $this ); } return $this; } public function removePosition( QuizzResponse $position ): self { if ( $this->position->removeElement( $position ) ) { // set the owning side to null (unless already changed) if ( $position->getQuizzQuestion() === $this ) { $position->setQuizzQuestion( NULL ); } } return $this; } public function getQuizz(): ?Quizz { return $this->quizz; } public function setQuizz( ?Quizz $quizz ): self { $this->quizz = $quizz; return $this; } }