0])] public int $ordering; #[ORM\Column(type: Types::STRING, length: 255)] public string $question; #[ORM\JoinColumn(nullable: false)] #[ORM\ManyToOne(inversedBy: 'questions')] public Quiz $quiz; #[ORM\Column] public bool $enabled = true; /** @var Collection */ #[ORM\OneToMany(targetEntity: Answer::class, mappedBy: 'question', cascade: ['persist'], orphanRemoval: true)] #[ORM\OrderBy(['ordering' => 'ASC'])] public private(set) Collection $answers; public function __construct() { $this->answers = new ArrayCollection(); } public function addAnswer(Answer $answer): static { if (!$this->answers->contains($answer)) { $this->answers->add($answer); $answer->question = $this; } return $this; } public function __toString(): string { return $this->question ?? ''; } }