Controller/Product/ProductAdminController.php
public function editAction($id)
    {
        $product = $this->container->get('vespolina.product_manager')->findProductById($id);

        if (!$product) {
            throw new NotFoundHttpException('The product does not exist!');
        }

        $formHandler = $this->container->get('vespolina.product.form.handler');

        $process = $formHandler->process($product);
        if ($process) {
            $this->setFlash('vespolina_product_updated', 'success');
            $url = $this->container->get('router')->generate('vespolina_product_list');

            return new RedirectResponse($url);
        }

        $form = $this->container->get('vespolina.product.form');
        $form->setData($product);

        return $this->container->get('templating')->renderResponse('VespolinaCommerceBundle:Product:edit.html.'.$this->getEngine(), array(
            'form'                   => $form->createView(),
            'id'                     => $id,
            'configuredOptionGroups' => $this->getConfiguredOptionsGroups(),
        ));
    }
public function editAction($id)
    {
        $product = $this->container->get('vespolina.product_manager')->findProductById($id);

        if (!$product) {
            throw new NotFoundHttpException('The product does not exist!');
        }

        $formHandler = $this->container->get('vespolina.product.form.handler');

        $process = $formHandler->process($product);
        if ($process) {
            $this->setFlash('vespolina_product_updated', 'success');
            $url = $this->container->get('router')->generate('vespolina_product_list');

            return new RedirectResponse($url);
        }

        $form = $this->container->get('vespolina.product.form');
        $form->setData($product);

        return $this->container->get('templating')->renderResponse('VespolinaCommerceBundle:Product:edit.html.'.$this->getEngine(), array(
            'form'                   => $form->createView(),
            'id'                     => $id,
            'configuredOptionGroups' => $this->getConfiguredOptionsGroups(),
        ));
    }
public function editAction ( $ id ) { $ product = $ this -> container -> get ( 'vespolina.product_manager' ) -> findProductById ( $ id ) ; if ( ! $ product ) { throw new NotFoundHttpException ( 'The product does not exist!' ) ; } $ formHandler = $ this -> container -> get ( 'vespolina.product.form.handler' ) ; $ process = $ formHandler -> process ( $ product ) ; if ( $ process ) { $ this -> setFlash ( 'vespolina_product_updated' , 'success' ) ; $ url = $ this -> container -> get ( 'router' ) -> generate ( 'vespolina_product_list' ) ; return new RedirectResponse ( $ url ) ; } $ form = $ this -> container -> get ( 'vespolina.product.form' ) ; $ form -> setData ( $ product ) ; return $ this -> container -> get ( 'templating' ) -> renderResponse ( 'VespolinaCommerceBundle:Product:edit.html.' . $ this -> getEngine ( ) , array ( 'form' => $ form -> createView ( ) , 'id' => $ id , 'configuredOptionGroups' => $ this -> getConfiguredOptionsGroups ( ) , ) ) ; }
Edit one product, show the edit form
Edit one product show the edit form