src/Entity/Question.php line 14
<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiResource;use App\Repository\QuestionRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: QuestionRepository::class)]#[ApiResource]class Question{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(type: Types::TEXT)]private ?string $text = null;#[ORM\ManyToOne(inversedBy: 'questions')]private ?Quiz $quiz = null;#[ORM\OneToMany(mappedBy: 'question', targetEntity: Answere::class , cascade: ['persist'],orphanRemoval: true)]private Collection $answeres;#[ORM\OneToMany(mappedBy: 'question', targetEntity: GivenAnswere::class)]private Collection $givenAnsweres;public function __construct(){$this->answeres = new ArrayCollection();$this->givenAnsweres = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function __toString(): string{return $this->text;}public function getText(): ?string{return $this->text;}public function setText(string $text): self{$this->text = $text;return $this;}public function getQuiz(): ?Quiz{return $this->quiz;}public function setQuiz(?Quiz $quiz): self{$this->quiz = $quiz;return $this;}/*** @return Collection<int, Answere>*/public function getAnsweres(): Collection{return $this->answeres;}public function addAnswere(Answere $answere): self{if (!$this->answeres->contains($answere)) {$this->answeres->add($answere);$answere->setQuestion($this);}return $this;}public function removeAnswere(Answere $answere): self{if ($this->answeres->removeElement($answere)) {// set the owning side to null (unless already changed)if ($answere->getQuestion() === $this) {$answere->setQuestion(null);}}return $this;}/*** @return Collection<int, GivenAnswere>*/public function getGivenAnsweres(): Collection{return $this->givenAnsweres;}public function addGivenAnswere(GivenAnswere $givenAnswere): self{if (!$this->givenAnsweres->contains($givenAnswere)) {$this->givenAnsweres->add($givenAnswere);$givenAnswere->setQuestion($this);}return $this;}public function removeGivenAnswere(GivenAnswere $givenAnswere): self{if ($this->givenAnsweres->removeElement($givenAnswere)) {// set the owning side to null (unless already changed)if ($givenAnswere->getQuestion() === $this) {$givenAnswere->setQuestion(null);}}return $this;}}