src/Flowcode/ShopBundle/Controller/AdminProductController.php
/**
     * Edits an existing GalleryItem entity.
     *
     * @Route("/{id}/galleryitem/{entity}", name="admin_product_gallery_update")
     * @Method("PUT")
     * @Template("FlowcodeShopBundle:AdminProduct:gallery_edit_item.html.twig")
     */
Edits an existing GalleryItem entity.
Edits an existing GalleryItem entity .
public function updateGalleryItemAction(Request $request, GalleryItem $entity, Product $product)
    {
        $em = $this->getDoctrine()->getManager();
        if (!$entity) {
            throw $this->createNotFoundException('Unable to find GalleryItem entity.');
        }
        $deleteForm = $this->createDeleteGalleryItemForm($entity->getId());
        $editForm = $this->createEditGalleryItemForm($entity, $product);
        $editForm->handleRequest($request);
        if ($editForm->isValid()) {
            $em->flush();
            return $this->redirect($this->generateUrl('admin_product_show', array('id' => $product->getId())));
        }
        return array(
            'entity' => $entity,
            'product' => $product,
            'edit_form' => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
public function updateGalleryItemAction ( Request $ request , GalleryItem $ entity , Product $ product ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find GalleryItem entity.' ) ; } $ deleteForm = $ this -> createDeleteGalleryItemForm ( $ entity -> getId ( ) ) ; $ editForm = $ this -> createEditGalleryItemForm ( $ entity , $ product ) ; $ editForm -> handleRequest ( $ request ) ; if ( $ editForm -> isValid ( ) ) { $ em -> flush ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'admin_product_show' , array ( 'id' => $ product -> getId ( ) ) ) ) ; } return array ( 'entity' => $ entity , 'product' => $ product , 'edit_form' => $ editForm -> createView ( ) , 'delete_form' => $ deleteForm -> createView ( ) , ) ; }
Edits an existing GalleryItem entity.
Edits an existing GalleryItem entity .