*/ #[ORM\OneToMany(targetEntity: Comment::class, mappedBy: 'conference', orphanRemoval: true)] private Collection $comments; public function __construct() { $this->comments = new ArrayCollection(); } public function __toString(): string { return $this->city . ' ' . $this->year; } public function getId(): ?int { return $this->id; } public function getCity(): ?string { return $this->city; } public function setCity(string $city): static { $this->city = $city; return $this; } public function getYear(): ?string { return $this->year; } public function setYear(string $year): static { $this->year = $year; return $this; } public function isInternational(): ?bool { return $this->isInternational; } public function setInternational(bool $isInternational): static { $this->isInternational = $isInternational; return $this; } /** * @return Collection */ public function getComments(): Collection { return $this->comments; } public function addComment(Comment $comment): static { if (!$this->comments->contains($comment)) { $this->comments->add($comment); $comment->setConference($this); } return $this; } public function removeComment(Comment $comment): static { if ($this->comments->removeElement($comment)) { // set the owning side to null (unless already changed) if ($comment->getConference() === $this) { $comment->setConference(null); } } return $this; } }