public function processUpdateSeoAction()
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth($this->resourceCode, $this->getModuleCode(), AccessManager::UPDATE)) {
            return $response;
        }

        // Error (Default: false)
        $error_msg = false;

        // Create the Form from the request
        $updateSeoForm = $this->getUpdateSeoForm($this->getRequest());

        // Pass the object id to the request
        $this->getRequest()->attributes->set($this->objectName . '_id', $this->getRequest()->get('current_id'));

        try {
            // Check the form against constraints violations
            $form = $this->validateForm($updateSeoForm, "POST");

            // Get the form field values
            $data = $form->getData();

            // Create a new event object with the modified fields
            $updateSeoEvent = $this->getUpdateSeoEvent($data);

            // Dispatch Update SEO Event
            $this->dispatch($this->updateSeoEventIdentifier, $updateSeoEvent);

            // Execute additional Action
            $response = $this->performAdditionalUpdateSeoAction($updateSeoEvent);

            if ($response == null) {
                // If we have to stay on the same page, do not redirect to the successUrl,
                // just redirect to the edit page again.
                if ($this->getRequest()->get('save_mode') == 'stay') {
                    return $this->redirectToEditionTemplate($this->getRequest());
                }

                // Redirect to the success URL
                return $this->generateSuccessRedirect($updateSeoForm);
            } else {
                return $response;
            }
        } catch (FormValidationException $ex) {
            // Form cannot be validated
            $error_msg = $this->createStandardFormValidationErrorMessage($ex);
            /*} catch (\Exception $ex) {
                // Any other error
                $error_msg = $ex->getMessage();*/
        }

        // Load object if exist
        if (null !== $object = $this->getExistingObject()) {
            // Hydrate the form abd pass it to the parser
            $changeForm = $this->hydrateObjectForm($object);

            // Pass it to the parser
            $this->getParserContext()->addForm($changeForm);
        }

        if (false !== $error_msg) {
            $this->setupFormErrorContext(
                $this->getTranslator()->trans("%obj SEO modification", array('%obj' => $this->objectName)),
                $error_msg,
                $updateSeoForm,
                $ex
            );

            // At this point, the form has errors, and should be redisplayed.
            return $this->renderEditionTemplate();
        }
    }
public function processUpdateSeoAction()
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth($this->resourceCode, $this->getModuleCode(), AccessManager::UPDATE)) {
            return $response;
        }

        // Error (Default: false)
        $error_msg = false;

        // Create the Form from the request
        $updateSeoForm = $this->getUpdateSeoForm($this->getRequest());

        // Pass the object id to the request
        $this->getRequest()->attributes->set($this->objectName . '_id', $this->getRequest()->get('current_id'));

        try {
            // Check the form against constraints violations
            $form = $this->validateForm($updateSeoForm, "POST");

            // Get the form field values
            $data = $form->getData();

            // Create a new event object with the modified fields
            $updateSeoEvent = $this->getUpdateSeoEvent($data);

            // Dispatch Update SEO Event
            $this->dispatch($this->updateSeoEventIdentifier, $updateSeoEvent);

            // Execute additional Action
            $response = $this->performAdditionalUpdateSeoAction($updateSeoEvent);

            if ($response == null) {
                // If we have to stay on the same page, do not redirect to the successUrl,
                // just redirect to the edit page again.
                if ($this->getRequest()->get('save_mode') == 'stay') {
                    return $this->redirectToEditionTemplate($this->getRequest());
                }

                // Redirect to the success URL
                return $this->generateSuccessRedirect($updateSeoForm);
            } else {
                return $response;
            }
        } catch (FormValidationException $ex) {
            // Form cannot be validated
            $error_msg = $this->createStandardFormValidationErrorMessage($ex);
            /*} catch (\Exception $ex) {
                // Any other error
                $error_msg = $ex->getMessage();*/
        }

        // Load object if exist
        if (null !== $object = $this->getExistingObject()) {
            // Hydrate the form abd pass it to the parser
            $changeForm = $this->hydrateObjectForm($object);

            // Pass it to the parser
            $this->getParserContext()->addForm($changeForm);
        }

        if (false !== $error_msg) {
            $this->setupFormErrorContext(
                $this->getTranslator()->trans("%obj SEO modification", array('%obj' => $this->objectName)),
                $error_msg,
                $updateSeoForm,
                $ex
            );

            // At this point, the form has errors, and should be redisplayed.
            return $this->renderEditionTemplate();
        }
    }
public function processUpdateSeoAction ( ) { // Check current user authorization if ( null !== $ response = $ this -> checkAuth ( $ this -> resourceCode , $ this -> getModuleCode ( ) , AccessManager :: UPDATE ) ) { return $ response ; } // Error (Default: false) $ error_msg = false ; // Create the Form from the request $ updateSeoForm = $ this -> getUpdateSeoForm ( $ this -> getRequest ( ) ) ; // Pass the object id to the request $ this -> getRequest ( ) -> attributes -> set ( $ this -> objectName . '_id' , $ this -> getRequest ( ) -> get ( 'current_id' ) ) ; try { // Check the form against constraints violations $ form = $ this -> validateForm ( $ updateSeoForm , "POST" ) ; // Get the form field values $ data = $ form -> getData ( ) ; // Create a new event object with the modified fields $ updateSeoEvent = $ this -> getUpdateSeoEvent ( $ data ) ; // Dispatch Update SEO Event $ this -> dispatch ( $ this -> updateSeoEventIdentifier , $ updateSeoEvent ) ; // Execute additional Action $ response = $ this -> performAdditionalUpdateSeoAction ( $ updateSeoEvent ) ; if ( $ response == null ) { // If we have to stay on the same page, do not redirect to the successUrl, // just redirect to the edit page again. if ( $ this -> getRequest ( ) -> get ( 'save_mode' ) == 'stay' ) { return $ this -> redirectToEditionTemplate ( $ this -> getRequest ( ) ) ; } // Redirect to the success URL return $ this -> generateSuccessRedirect ( $ updateSeoForm ) ; } else { return $ response ; } } catch ( FormValidationException $ ex ) { // Form cannot be validated $ error_msg = $ this -> createStandardFormValidationErrorMessage ( $ ex ) ; /*} catch (\Exception $ex) {
                // Any other error
                $error_msg = $ex->getMessage();*/ } // Load object if exist if ( null !== $ object = $ this -> getExistingObject ( ) ) { // Hydrate the form abd pass it to the parser $ changeForm = $ this -> hydrateObjectForm ( $ object ) ; // Pass it to the parser $ this -> getParserContext ( ) -> addForm ( $ changeForm ) ; } if ( false !== $ error_msg ) { $ this -> setupFormErrorContext ( $ this -> getTranslator ( ) -> trans ( "%obj SEO modification" , array ( '%obj' => $ this -> objectName ) ) , $ error_msg , $ updateSeoForm , $ ex ) ; // At this point, the form has errors, and should be redisplayed. return $ this -> renderEditionTemplate ( ) ; } }
Update SEO modification, and either go back to the object list, or stay on the edition page.

@return \Thelia\Core\HttpFoundation\Response the response
Update SEO modification and either go back to the object list or stay on the edition page .