/** @param Lecture $lecture */ public function unfavLecture(Lecture $lecture) { if ($this->favoriteLectures->contains($lecture)) { $this->favoriteLectures->removeElement($lecture); $this->favoriteLectureIds = array_unique(array_diff($this->favoriteLectureIds, [$lecture->getId()])); } if ($lecture->getUsersFavorited()->contains($this)) { $lecture->getUsersFavorited()->removeElement($this); $lecture->setFavsCount($lecture->getFavsCount() - 1); } }
/** * Remove lecture * * @param \Lecture $lecture */ public function removeLecture(\Lecture $lecture) { $this->lectures->removeElement($lecture); }