titles = new ArrayCollection(); } /** * @return int */ public function getId(): int { return $this->id; } /** * @param int $id * @return Judge */ public function setId(int $id): Judge { $this->id = $id; return $this; } /** * @return string */ public function getName(): string { return $this->name; } /** * @param string $name * @return Judge */ public function setName(string $name): Judge { $this->name = $name; return $this; } /** * @return string */ public function getSlug(): string { return $this->slug; } /** * @param string $slug * @return Judge */ public function setSlug(string $slug): Judge { $this->slug = $slug; return $this; } /** * @return JudgeTitle[]|Collection */ public function getTitles() { return $this->titles; } /** * @param JudgeTitle $title * @return Judge */ public function addTitle(JudgeTitle $title): Judge { if(!$this->titles->contains($title)) { $this->titles->add($title); } return $this; } /** * @param JudgeTitle $title * @return Judge */ public function removeTitle(JudgeTitle $title): Judge { if($this->titles->contains($title)) { $this->titles->removeElement($title); } return $this; } /** * @param JudgeTitle[]|Collection $titles * @return Judge */ public function setTitles($titles) { $this->titles = $titles; return $this; } /** * @return array */ public function jsonSerialize() { return [ 'id' => $this->getId(), 'name' => $this->getName(), 'titles' => $this->getTitles()->getValues(), 'slug' => $this->getSlug(), ]; } }