public function updateAction(Request $request): Response
    {
        $form = $this->formFactory->updateLocation();
        $form->handleRequest($request);

        $location = $form->getData()->getLocation();

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (LocationUpdateData $data) {
                $location = $data->getLocation();

                $locationUpdateStruct = new LocationUpdateStruct(['sortField' => $data->getSortField(), 'sortOrder' => $data->getSortOrder()]);
                $this->locationService->updateLocation($location, $locationUpdateStruct);

                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("Location '%name%' updated.") */
                        'location.update.success',
                        ['%name%' => $location->getContentInfo()->name],
                        'location'
                    )
                );

                return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
                        'locationId' => $location->getContentInfo()->mainLocationId,
                        '_fragment' => DetailsTab::URI_FRAGMENT,
                    ]));
            });

            if ($result instanceof Response) {
                return $result;
            }
        }

        return $this->redirect($this->generateUrl('_ezpublishLocation', [
            'locationId' => $location->getContentInfo()->mainLocationId,
            '_fragment' => DetailsTab::URI_FRAGMENT,
        ]));
    }
public function updateAction(Request $request): Response
    {
        $form = $this->formFactory->updateLocation();
        $form->handleRequest($request);

        $location = $form->getData()->getLocation();

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (LocationUpdateData $data) {
                $location = $data->getLocation();

                $locationUpdateStruct = new LocationUpdateStruct(['sortField' => $data->getSortField(), 'sortOrder' => $data->getSortOrder()]);
                $this->locationService->updateLocation($location, $locationUpdateStruct);

                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("Location '%name%' updated.") */
                        'location.update.success',
                        ['%name%' => $location->getContentInfo()->name],
                        'location'
                    )
                );

                return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
                        'locationId' => $location->getContentInfo()->mainLocationId,
                        '_fragment' => DetailsTab::URI_FRAGMENT,
                    ]));
            });

            if ($result instanceof Response) {
                return $result;
            }
        }

        return $this->redirect($this->generateUrl('_ezpublishLocation', [
            'locationId' => $location->getContentInfo()->mainLocationId,
            '_fragment' => DetailsTab::URI_FRAGMENT,
        ]));
    }
public function updateAction ( Request $ request ) : Response { $ form = $ this -> formFactory -> updateLocation ( ) ; $ form -> handleRequest ( $ request ) ; $ location = $ form -> getData ( ) -> getLocation ( ) ; if ( $ form -> isSubmitted ( ) ) { $ result = $ this -> submitHandler -> handle ( $ form , function ( LocationUpdateData $ data ) { $ location = $ data -> getLocation ( ) ; $ locationUpdateStruct = new LocationUpdateStruct ( [ 'sortField' => $ data -> getSortField ( ) , 'sortOrder' => $ data -> getSortOrder ( ) ] ) ; $ this -> locationService -> updateLocation ( $ location , $ locationUpdateStruct ) ; $ this -> notificationHandler -> success ( $ this -> translator -> trans ( /** @Desc("Location '%name%' updated.") */ 'location.update.success' , [ '%name%' => $ location -> getContentInfo ( ) -> name ] , 'location' ) ) ; return new RedirectResponse ( $ this -> generateUrl ( '_ezpublishLocation' , [ 'locationId' => $ location -> getContentInfo ( ) -> mainLocationId , '_fragment' => DetailsTab :: URI_FRAGMENT , ] ) ) ; } ) ; if ( $ result instanceof Response ) { return $ result ; } } return $ this -> redirect ( $ this -> generateUrl ( '_ezpublishLocation' , [ 'locationId' => $ location -> getContentInfo ( ) -> mainLocationId , '_fragment' => DetailsTab :: URI_FRAGMENT , ] ) ) ; }
Handles update existing location.

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

@return \Symfony\Component\HttpFoundation\Response
Handles update existing location .