Exemplo n.º 1
0
 /**
  * Adds or updates an existing playlist.
  *
  * @param Playlist $playlist
  */
 public function add(Playlist $playlist)
 {
     $tracks = $playlist->getTracks();
     $tracks_list = array();
     foreach ($tracks as $track) {
         $tracks_list[$track->getId()] = array('id' => $track->getId(), 'name' => $track->getName());
     }
     $this->content[$playlist->getId()] = array('id' => $playlist->getId(), 'name' => $playlist->getName(), 'tracks' => $tracks_list);
 }
Exemplo n.º 2
0
 public function includeTracks(Playlist $playlist)
 {
     return $this->collection($playlist->getTracks(), new TrackTransformer());
 }