src/Slashworks/AppBundle/Controller/CustomerController.php
public function updateAction(Request $request, $id)
        {

            /** @var Customer $oCustomer */
            $oCustomer = CustomerQuery::create()->findOneById($id);

            if (count($oCustomer) === 0) {
                throw $this->createNotFoundException('Unable to find Customer entity.');
            }

            $deleteForm = $this->createDeleteForm($id);
            $editForm   = $this->createEditForm($oCustomer);
            $editForm->handleRequest($request);


            if ($editForm->isValid()) {


                $sLogoPath = $this->_handleLogoUpload($request, $oCustomer);
                $oCustomer->setLogo($sLogoPath);

                $oCustomer->save();

                return $this->redirect($this->generateUrl('backend_system_customer'));
            }

            return $this->render('SlashworksAppBundle:Customer:edit.html.twig', array(
                'entity'      => $oCustomer,
                'edit_form'   => $editForm->createView(),
                'delete_form' => $deleteForm->createView(),
            ));
        }
public function updateAction(Request $request, $id)
        {

            /** @var Customer $oCustomer */
            $oCustomer = CustomerQuery::create()->findOneById($id);

            if (count($oCustomer) === 0) {
                throw $this->createNotFoundException('Unable to find Customer entity.');
            }

            $deleteForm = $this->createDeleteForm($id);
            $editForm   = $this->createEditForm($oCustomer);
            $editForm->handleRequest($request);


            if ($editForm->isValid()) {


                $sLogoPath = $this->_handleLogoUpload($request, $oCustomer);
                $oCustomer->setLogo($sLogoPath);

                $oCustomer->save();

                return $this->redirect($this->generateUrl('backend_system_customer'));
            }

            return $this->render('SlashworksAppBundle:Customer:edit.html.twig', array(
                'entity'      => $oCustomer,
                'edit_form'   => $editForm->createView(),
                'delete_form' => $deleteForm->createView(),
            ));
        }
public function updateAction ( Request $ request , $ id ) { /** @var Customer $oCustomer */ $ oCustomer = CustomerQuery :: create ( ) -> findOneById ( $ id ) ; if ( count ( $ oCustomer ) === 0 ) { throw $ this -> createNotFoundException ( 'Unable to find Customer entity.' ) ; } $ deleteForm = $ this -> createDeleteForm ( $ id ) ; $ editForm = $ this -> createEditForm ( $ oCustomer ) ; $ editForm -> handleRequest ( $ request ) ; if ( $ editForm -> isValid ( ) ) { $ sLogoPath = $ this -> _handleLogoUpload ( $ request , $ oCustomer ) ; $ oCustomer -> setLogo ( $ sLogoPath ) ; $ oCustomer -> save ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'backend_system_customer' ) ) ; } return $ this -> render ( 'SlashworksAppBundle:Customer:edit.html.twig' , array ( 'entity' => $ oCustomer , 'edit_form' => $ editForm -> createView ( ) , 'delete_form' => $ deleteForm -> createView ( ) , ) ) ; }
Update existing customer

@param \Symfony\Component\HttpFoundation\Request $request
@param  int                                      $id

@return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
Update existing customer