public function assignSectionAction(Request $request): Response
    {
        $form = $this->createForm(LocationAssignSectionType::class, new LocationAssignSubtreeData());
        $form->handleRequest($request);

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

                $this->sectionService->assignSectionToSubtree($location, $section);

                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("Section '%name%' has been assigned to subtree") */
                        'location.assign_section.success',
                        ['%name%' => $section->name],
                        'location'
                    )
                );

                return $this->redirectToLocation($location, DetailsTab::URI_FRAGMENT);
            });

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

        if (($location = $form->getData()->getLocation()) !== null) {
            return $this->redirectToLocation($location, DetailsTab::URI_FRAGMENT);
        }

        return $this->redirectToRoute('ezplatform.dashboard');
    }
public function assignSectionAction(Request $request): Response
    {
        $form = $this->createForm(LocationAssignSectionType::class, new LocationAssignSubtreeData());
        $form->handleRequest($request);

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

                $this->sectionService->assignSectionToSubtree($location, $section);

                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("Section '%name%' has been assigned to subtree") */
                        'location.assign_section.success',
                        ['%name%' => $section->name],
                        'location'
                    )
                );

                return $this->redirectToLocation($location, DetailsTab::URI_FRAGMENT);
            });

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

        if (($location = $form->getData()->getLocation()) !== null) {
            return $this->redirectToLocation($location, DetailsTab::URI_FRAGMENT);
        }

        return $this->redirectToRoute('ezplatform.dashboard');
    }
public function assignSectionAction ( Request $ request ) : Response { $ form = $ this -> createForm ( LocationAssignSectionType :: class , new LocationAssignSubtreeData ( ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) ) { $ result = $ this -> submitHandler -> handle ( $ form , function ( LocationAssignSubtreeData $ data ) { $ section = $ data -> getSection ( ) ; $ location = $ data -> getLocation ( ) ; $ this -> sectionService -> assignSectionToSubtree ( $ location , $ section ) ; $ this -> notificationHandler -> success ( $ this -> translator -> trans ( /** @Desc("Section '%name%' has been assigned to subtree") */ 'location.assign_section.success' , [ '%name%' => $ section -> name ] , 'location' ) ) ; return $ this -> redirectToLocation ( $ location , DetailsTab :: URI_FRAGMENT ) ; } ) ; if ( $ result instanceof Response ) { return $ result ; } } if ( ( $ location = $ form -> getData ( ) -> getLocation ( ) ) !== null ) { return $ this -> redirectToLocation ( $ location , DetailsTab :: URI_FRAGMENT ) ; } return $ this -> redirectToRoute ( 'ezplatform.dashboard' ) ; }
Handles assigning section to subtree.

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

@return \Symfony\Component\HttpFoundation\Response
Handles assigning section to subtree .