public function addAction(Request $request, Application $app)
 {
     if (!$request->request->has('name')) {
         return $app->json('Missing required parameter: name', 400);
     }
     if (!$request->request->has('short_biography')) {
         return $app->json('Missing required parameter: short_biography', 400);
     }
     $artist = new Artist();
     $artist->setName($request->request->get('name'));
     $artist->setShortBiography($request->request->get('short_biography'));
     $artist->setBiography($request->request->get('biography'));
     $artist->setSoundCloudUrl($request->request->get('soundcloud_url'));
     $app['repository.artist']->save($artist);
     $headers = array('Location' => '/api/artist/' . $artist->getId());
     return $app->json('Created', 201, $headers);
 }
 /**
  * Instantiates an artist entity and sets its properties using db data.
  *
  * @param array $artistData
  *   The array of db data.
  *
  * @return \MusicBox\Entity\Artist
  */
 protected function buildArtist($artistData)
 {
     $artist = new Artist();
     $artist->setId($artistData['artist_id']);
     $artist->setName($artistData['name']);
     $artist->setShortBiography($artistData['short_biography']);
     $artist->setBiography($artistData['biography']);
     $artist->setSoundCloudUrl($artistData['soundcloud_url']);
     $artist->setImage($artistData['image']);
     $artist->setLikes($artistData['likes']);
     $createdAt = new \DateTime('@' . $artistData['created_at']);
     $artist->setCreatedAt($createdAt);
     return $artist;
 }