コード例 #1
0
 /**
  * @Route(
  *      "/{resourceId}/drops/detail/{dropId}/add/correction",
  *      name="icap_dropzone_drops_detail_add_correction",
  *      requirements={"resourceId" = "\d+", "dropId" = "\d+"}
  * )
  * @ParamConverter("dropzone", class="IcapDropzoneBundle:Dropzone", options={"id" = "resourceId"})
  * @ParamConverter("user", options={
  *      "authenticatedUser" = true,
  *      "messageEnabled" = true,
  *      "messageTranslationKey" = "Correct an evaluation requires authentication. Please login.",
  *      "messageTranslationDomain" = "icap_dropzone"
  * })
  * @ParamConverter("drop", class="IcapDropzoneBundle:Drop", options={"id" = "dropId"})
  * @Template()
  */
 public function dropsDetailAddCorrectionAction($dropzone, $user, $drop)
 {
     $this->get('icap.manager.dropzone_voter')->isAllowToOpen($dropzone);
     $this->get('icap.manager.dropzone_voter')->isAllowToEdit($dropzone);
     $em = $this->getDoctrine()->getManager();
     $correction = new Correction();
     $correction->setUser($user);
     $correction->setDropzone($dropzone);
     $correction->setDrop($drop);
     //Allow admins to edit this correction
     $correction->setEditable(true);
     $em->persist($correction);
     $em->flush();
     $event = new LogCorrectionStartEvent($dropzone, $drop, $correction);
     $this->dispatch($event);
     return $this->redirect($this->generateUrl('icap_dropzone_drops_detail_correction', array('resourceId' => $dropzone->getId(), 'state' => 'edit', 'correctionId' => $correction->getId())));
 }