public function updateAction(Request $request, Role $role)
    {
        $this->isAllowed('BUSINESS_MANAGE_ROLE');

        $em = $this->getDoctrine()->getManager();

        if (!$role) {
            throw $this->createNotFoundException('Unable to find Role entity.');
        }

        $editForm = $this->createEditForm($role);
        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $em->flush();
            $this->get('session')->getFlashBag()->add('success', 'role.flash.updated');

            return $this->redirect($this->generateUrl('sam_role'));
        }

        return $this->render('CanalTPSamEcoreSecurityBundle:Role:edit.html.twig', array(
            'entity'      => $role,
            'edit_form'   => $editForm->createView()
        ));
    }