public function unlinkFromPlaylistAction(Request $request, $id)
{
$em = $this->container->get('em');
$user = $this->container->get('user')->getCurrentUser();
if (!$user->hasPermission('ManagePlaylist')) {
throw new AccessDeniedException('You do not have the right to manage playlists.');
}
$playlist = $em->getRepository('Newscoop\\Entity\\Playlist')->getPlaylist($id)->getOneOrNullResult();
if (!$playlist) {
throw new NotFoundHttpException('Result was not found.');
}
$this->linkOrUnlinkResources($playlist, $request, 'unlink');
return $playlist;
}