EcommerceBundle/Controller/FeatureValueController.php
public function updateAction(Request $request, $featureId, $id)
    {
        $em = $this->getDoctrine()->getManager();

        /** @var Feature $feature */
        $feature = $em->getRepository('EcommerceBundle:Feature')->find($featureId);

        if (!$feature) {
            throw $this->createNotFoundException('Unable to find Feature entity.');
        }

        /** @var FeatureValue $entity */
        $entity = $em->getRepository('EcommerceBundle:FeatureValue')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find FeatureValue entity.');
        }

        $deleteForm = $this->createDeleteForm($featureId, $id);
        $editForm = $this->createForm(new FeatureValueType(), $entity);
        $editForm->bind($request);

        if ($editForm->isValid()) {
            $em->persist($entity);
            $em->flush();

            $this->get('session')->getFlashBag()->add('success', 'value.edited');

            return $this->redirect($this->generateUrl('ecommerce_featurevalue_show', array('featureId' => $featureId, 'id' => $id)));
        }

        return array(
            'entity'      => $entity,
            'feature'   => $feature,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
public function updateAction(Request $request, $featureId, $id)
    {
        $em = $this->getDoctrine()->getManager();

        /** @var Feature $feature */
        $feature = $em->getRepository('EcommerceBundle:Feature')->find($featureId);

        if (!$feature) {
            throw $this->createNotFoundException('Unable to find Feature entity.');
        }

        /** @var FeatureValue $entity */
        $entity = $em->getRepository('EcommerceBundle:FeatureValue')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find FeatureValue entity.');
        }

        $deleteForm = $this->createDeleteForm($featureId, $id);
        $editForm = $this->createForm(new FeatureValueType(), $entity);
        $editForm->bind($request);

        if ($editForm->isValid()) {
            $em->persist($entity);
            $em->flush();

            $this->get('session')->getFlashBag()->add('success', 'value.edited');

            return $this->redirect($this->generateUrl('ecommerce_featurevalue_show', array('featureId' => $featureId, 'id' => $id)));
        }

        return array(
            'entity'      => $entity,
            'feature'   => $feature,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
public function updateAction ( Request $ request , $ featureId , $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; /** @var Feature $feature */ $ feature = $ em -> getRepository ( 'EcommerceBundle:Feature' ) -> find ( $ featureId ) ; if ( ! $ feature ) { throw $ this -> createNotFoundException ( 'Unable to find Feature entity.' ) ; } /** @var FeatureValue $entity */ $ entity = $ em -> getRepository ( 'EcommerceBundle:FeatureValue' ) -> find ( $ id ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find FeatureValue entity.' ) ; } $ deleteForm = $ this -> createDeleteForm ( $ featureId , $ id ) ; $ editForm = $ this -> createForm ( new FeatureValueType ( ) , $ entity ) ; $ editForm -> bind ( $ request ) ; if ( $ editForm -> isValid ( ) ) { $ em -> persist ( $ entity ) ; $ em -> flush ( ) ; $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , 'value.edited' ) ; return $ this -> redirect ( $ this -> generateUrl ( 'ecommerce_featurevalue_show' , array ( 'featureId' => $ featureId , 'id' => $ id ) ) ) ; } return array ( 'entity' => $ entity , 'feature' => $ feature , 'edit_form' => $ editForm -> createView ( ) , 'delete_form' => $ deleteForm -> createView ( ) , ) ; }
Edits an existing FeatureValue entity.

@param Request $request   The request
@param int     $featureId The feature id
@param int     $id        The entity id

@throws NotFoundHttpException
@return array|RedirectResponse

@Route("/{id}")
@Method("PUT")
@Template("EcommerceBundle:Feature:edit.html.twig")
Edits an existing FeatureValue entity .