/**
  * Edits an existing InteractionQCM entity.
  *
  * @access public
  *
  * @param integer $id id of InteractionQCM
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function updateAction($id)
 {
     $exoID = $this->container->get('request')->request->get('exercise');
     $user = $this->container->get('security.token_storage')->getToken()->getUser();
     $catID = -1;
     $em = $this->getDoctrine()->getManager();
     $interQCM = $em->getRepository('UJMExoBundle:InteractionQCM')->find($id);
     if (!$interQCM) {
         throw $this->createNotFoundException('Unable to find InteractionQCM entity.');
     }
     if ($user->getId() != $interQCM->getInteraction()->getQuestion()->getUser()->getId()) {
         $catID = $interQCM->getInteraction()->getQuestion()->getCategory()->getId();
     }
     $editForm = $this->createForm(new InteractionQCMType($this->container->get('security.token_storage')->getToken()->getUser(), $catID), $interQCM);
     $formHandler = new InteractionQCMHandler($editForm, $this->get('request'), $this->getDoctrine()->getManager(), $this->container->get('ujm.exercise_services'), $this->container->get('security.token_storage')->getToken()->getUser(), $this->get('translator'));
     if ($formHandler->processUpdate($interQCM)) {
         if ($exoID == -1) {
             return $this->redirect($this->generateUrl('ujm_question_index'));
         } else {
             return $this->redirect($this->generateUrl('ujm_exercise_questions', array('id' => $exoID)));
         }
     }
     return $this->forward('UJMExoBundle:Question:edit', array('exoID' => $exoID, 'id' => $interQCM->getInteraction()->getQuestion()->getId(), 'form' => $editForm));
 }