protected function performUpdate(Request $request)
 {
     try {
         $root = $this->getMembership()->getItem();
         $entity = $this->repository->findEntity($request->get('i'));
         $progress = $request->get('p');
         if (!$this->repository->isAllowed($entity, $root, true)) {
             return new JsonResponse(['success' => 0]);
         }
         $milestone = $this->repository->findMilestone($request->get('m'), $entity, $this->extractProject($root));
         $answer = ['success' => 1];
         $answer['milestone'] = $this->repository->updateMilestone($entity, $milestone, $root, $progress);
         $answer['progressBar'] = $this->repository->computeTotalProgress($entity, $this->extractProject($root));
         return new JsonResponse($answer);
     } catch (ModelException $exception) {
         return new JsonResponse(['success' => 0, 'error' => $exception->getMessage()]);
     }
 }
 public function render(CantigaController $controller, Request $request, Workspace $workspace, Project $project = null)
 {
     $entity = $controller->getMembership()->getItem()->getEntity();
     return $this->templating->render('CantigaMilestoneBundle:Dashboard:milestone-progress.html.twig', ['progress' => $this->repository->computeTotalProgress($entity, $project), 'incomingDeadline' => $this->repository->findClosestDeadline($entity, $project), 'milestoneEditorPage' => lcfirst($entity->getType()) . '_milestone_editor']);
 }