/** * Remove favorites * * @param E100\CoreBundle\Entity\Text $favorites */ public function removeFavorite(\E100\CoreBundle\Entity\Text $favorites) { if (!$this->favorites->contains($favorites)) { throw new \Exception('This text is not a favorit'); } $this->favorites->removeElement($favorites); return $this; }