예제 #1
0
 public function updateAction(Request $request, Image $image)
 {
     $em = $this->getDoctrine()->getManager();
     $entity = $em->getRepository('WellnessCoreBundle:Image')->find($image->getId());
     if (!$entity) {
         throw $this->createNotFoundException('Unable to find Image entity.');
     }
     $deleteForm = $this->createDeleteForm($image->getId());
     $editForm = $this->createEditForm($entity);
     $editForm->handleRequest($request);
     if ($editForm->isValid()) {
         $em->flush();
         return $this->redirect($this->generateUrl('admin_image'));
     }
     return $this->render('WellnessCoreBundle:BackEnd/Image:edit.html.twig', array('entity' => $entity, 'edit_form' => $editForm->createView(), 'delete_form' => $deleteForm->createView()));
 }