public function handle(Command $command)
 {
     $request = $command->getRequest();
     $playlist = Playlist::create(uniqid(), $request->get('name'));
     $this->playlist_repository->add($playlist);
     return $playlist;
 }
 private function buildPlaylist($raw_playlist)
 {
     $playlist = Playlist::create($raw_playlist['id'], $raw_playlist['name']);
     if (isset($raw_playlist['tracks'])) {
         foreach ($raw_playlist['tracks'] as $raw_track) {
             $track = new \stdClass();
             $track->id = $raw_track['id'];
             $track->name = $raw_track['name'];
             $playlist->addTrack($this->track_builder->buildTrack($track));
         }
     }
     return $playlist;
 }
 public function includeTracks(Playlist $playlist)
 {
     return $this->collection($playlist->getTracks(), new TrackTransformer());
 }
Exemple #4
0
 public function build()
 {
     return Playlist::create($this->id, $this->name);
 }