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