コード例 #1
0
ファイル: User.php プロジェクト: Tekstove/Tekstove-api
 /**
  * @param  ChildArtist $artist The ChildArtist object to remove.
  * @return $this|ChildUser The current object (for fluent API support)
  */
 public function removeArtist(ChildArtist $artist)
 {
     if ($this->getArtists()->contains($artist)) {
         $pos = $this->collArtists->search($artist);
         $this->collArtists->remove($pos);
         if (null === $this->artistsScheduledForDeletion) {
             $this->artistsScheduledForDeletion = clone $this->collArtists;
             $this->artistsScheduledForDeletion->clear();
         }
         $this->artistsScheduledForDeletion[] = $artist;
         $artist->setUser(null);
     }
     return $this;
 }
コード例 #2
0
ファイル: Lyric.php プロジェクト: Tekstove/Tekstove-api
 /**
  * Remove artist of this object
  * through the artist_lyric cross reference table.
  *
  * @param ChildArtist $artist
  * @return ChildLyric The current object (for fluent API support)
  */
 public function removeArtist(ChildArtist $artist)
 {
     if ($this->getArtists()->contains($artist)) {
         $artistLyric = new ArtistLyric();
         $artistLyric->setArtist($artist);
         if ($artist->isLyricsLoaded()) {
             //remove the back reference if available
             $artist->getLyrics()->removeObject($this);
         }
         $artistLyric->setLyric($this);
         $this->removeArtistLyric(clone $artistLyric);
         $artistLyric->clear();
         $this->collArtists->remove($this->collArtists->search($artist));
         if (null === $this->artistsScheduledForDeletion) {
             $this->artistsScheduledForDeletion = clone $this->collArtists;
             $this->artistsScheduledForDeletion->clear();
         }
         $this->artistsScheduledForDeletion->push($artist);
     }
     return $this;
 }