Exemple #1
0
 /** @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);
     }
 }
Exemple #2
0
 /**
  * Remove lecture
  *
  * @param \Lecture $lecture
  */
 public function removeLecture(\Lecture $lecture)
 {
     $this->lectures->removeElement($lecture);
 }