public function showAction(Request $request, $ownerName, $name)
{
$format = $request->getRequestFormat();
/* @var $bundle Bundle */
$bundle = $this->getRepository('Bundle')->findOneByOwnerNameAndName($ownerName, $name);
if (!$bundle) {
if ('json' === $format) {
return new JsonResponse(array('status' => 'error', 'message' => 'Bundle not found.'), 404);
}
throw new NotFoundHttpException(sprintf('The bundle "%s/%s" does not exist', $ownerName, $name));
}
if ('json' === $format) {
return new JsonResponse($bundle->toBigArray());
}
$this->highlightMenu('bundles');
$owner = $this->get('security.context')->getToken()->getUser();
$scoresNumber = $this->container->getParameter('knp_bundles.bundle.graph.view_page.scores_number');
return $this->render('KnpBundlesBundle:Bundle:show.html.twig', array('series' => array(array('name' => 'Score', 'data' => $bundle->getScores($scoresNumber))), 'bundle' => $bundle, 'score_details' => $bundle->getScoreDetails(), 'isUsedByDeveloper' => $owner instanceof Developer && $owner->isUsingBundle($bundle), 'isFavoritedByDeveloper' => $owner instanceof Developer && $owner->hasFavoritedBundle($bundle)));
}