/** * Remove lyric of this object * through the lyric_language cross reference table. * * @param ChildLyric $lyric * @return ChildLanguage The current object (for fluent API support) */ public function removeLyric(ChildLyric $lyric) { if ($this->getLyrics()->contains($lyric)) { $lyricLanguage = new LyricLanguage(); $lyricLanguage->setLyric($lyric); if ($lyric->isLanguagesLoaded()) { //remove the back reference if available $lyric->getLanguages()->removeObject($this); } $lyricLanguage->setLanguage($this); $this->removeLyricLanguage(clone $lyricLanguage); $lyricLanguage->clear(); $this->collLyrics->remove($this->collLyrics->search($lyric)); if (null === $this->lyricsScheduledForDeletion) { $this->lyricsScheduledForDeletion = clone $this->collLyrics; $this->lyricsScheduledForDeletion->clear(); } $this->lyricsScheduledForDeletion->push($lyric); } return $this; }
/** * @param ChildLyric $lyric The ChildLyric object to remove. * @return $this|ChildUser The current object (for fluent API support) */ public function removeLyric(ChildLyric $lyric) { if ($this->getLyrics()->contains($lyric)) { $pos = $this->collLyrics->search($lyric); $this->collLyrics->remove($pos); if (null === $this->lyricsScheduledForDeletion) { $this->lyricsScheduledForDeletion = clone $this->collLyrics; $this->lyricsScheduledForDeletion->clear(); } $this->lyricsScheduledForDeletion[] = $lyric; $lyric->setUser(null); } return $this; }