src/Flowcode/ShopBundle/Controller/AdminProductController.php
public function addMediaProductAction(Product $product, $type = null)
    {
        if ($type == 'type_image_file') {
            return $this->redirectToRoute('admin_product_new_image', array('id' => $product->getId()));
        }
        $entity = new Media();
        $entity->setMediaType($type);
        $form = $this->mediaCreateCreateForm($entity, $product);

        return array(
            'type' => $type,
            'entity' => $entity,
            'product' => $product,
            'form' => $form->createView(),
        );
    }
public function addMediaProductAction(Product $product, $type = null)
    {
        if ($type == 'type_image_file') {
            return $this->redirectToRoute('admin_product_new_image', array('id' => $product->getId()));
        }
        $entity = new Media();
        $entity->setMediaType($type);
        $form = $this->mediaCreateCreateForm($entity, $product);

        return array(
            'type' => $type,
            'entity' => $entity,
            'product' => $product,
            'form' => $form->createView(),
        );
    }
public function addMediaProductAction ( Product $ product , $ type = null ) { if ( $ type == 'type_image_file' ) { return $ this -> redirectToRoute ( 'admin_product_new_image' , array ( 'id' => $ product -> getId ( ) ) ) ; } $ entity = new Media ( ) ; $ entity -> setMediaType ( $ type ) ; $ form = $ this -> mediaCreateCreateForm ( $ entity , $ product ) ; return array ( 'type' => $ type , 'entity' => $ entity , 'product' => $ product , 'form' => $ form -> createView ( ) , ) ; }
Add media.

@Route("/{id}/addmedia/{type}", name="admin_product_new_media")
@Method("GET")
@Template("FlowcodeShopBundle:AdminProduct:media_new.html.twig")
Add media .