Пример #1
0
 /**
  * Remove lyric of this object
  * through the artist_lyric cross reference table.
  *
  * @param ChildLyric $lyric
  * @return ChildArtist The current object (for fluent API support)
  */
 public function removeLyric(ChildLyric $lyric)
 {
     if ($this->getLyrics()->contains($lyric)) {
         $artistLyric = new ArtistLyric();
         $artistLyric->setLyric($lyric);
         if ($lyric->isArtistsLoaded()) {
             //remove the back reference if available
             $lyric->getArtists()->removeObject($this);
         }
         $artistLyric->setArtist($this);
         $this->removeArtistLyric(clone $artistLyric);
         $artistLyric->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;
 }