src/Flowcode/ShopBundle/Controller/AdminBrandController.php
/**
     * Edits an existing Brand entity.
     *
     * @Route("/{id}", name="admin_brand_update")
     * @Method("PUT")
     * @Template("FlowcodeShopBundle:Brand:edit.html.twig")
     */
Edits an existing Brand entity.
Edits an existing Brand entity .
public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();
        $entity = $em->getRepository('AmulenShopBundle:Brand')->find($id);
        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Brand entity.');
        }
        $deleteForm = $this->createDeleteForm($id);
        $editForm = $this->createEditForm($entity);
        $editForm->handleRequest($request);
        if ($editForm->isValid()) {
            $em->flush();
            return $this->redirect($this->generateUrl('admin_brand_edit', array('id' => $id)));
        }
        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
public function updateAction ( Request $ request , $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = $ em -> getRepository ( 'AmulenShopBundle:Brand' ) -> find ( $ id ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find Brand entity.' ) ; } $ deleteForm = $ this -> createDeleteForm ( $ id ) ; $ editForm = $ this -> createEditForm ( $ entity ) ; $ editForm -> handleRequest ( $ request ) ; if ( $ editForm -> isValid ( ) ) { $ em -> flush ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'admin_brand_edit' , array ( 'id' => $ id ) ) ) ; } return array ( 'entity' => $ entity , 'edit_form' => $ editForm -> createView ( ) , 'delete_form' => $ deleteForm -> createView ( ) , ) ; }
Edits an existing Brand entity.
Edits an existing Brand entity .