public function bulkDeleteAction(Request $request): Response
    {
        $this->denyAccessUnlessGranted(new Attribute('section', 'edit'));
        $form = $this->formFactory->deleteSections(
            new SectionsDeleteData()
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (SectionsDeleteData $data) {
                foreach ($data->getSections() as $sectionId => $selected) {
                    $section = $this->sectionService->loadSection($sectionId);
                    $this->sectionService->deleteSection($section);

                    $this->notificationHandler->success(
                        $this->translator->trans(
                            /** @Desc("Section '%name%' removed.") */
                            'section.delete.success',
                            ['%name%' => $section->name],
                            'section'
                        )
                    );
                }
            });

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

        return $this->redirect($this->generateUrl('ezplatform.section.list'));
    }
public function bulkDeleteAction(Request $request): Response
    {
        $this->denyAccessUnlessGranted(new Attribute('section', 'edit'));
        $form = $this->formFactory->deleteSections(
            new SectionsDeleteData()
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (SectionsDeleteData $data) {
                foreach ($data->getSections() as $sectionId => $selected) {
                    $section = $this->sectionService->loadSection($sectionId);
                    $this->sectionService->deleteSection($section);

                    $this->notificationHandler->success(
                        $this->translator->trans(
                            /** @Desc("Section '%name%' removed.") */
                            'section.delete.success',
                            ['%name%' => $section->name],
                            'section'
                        )
                    );
                }
            });

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

        return $this->redirect($this->generateUrl('ezplatform.section.list'));
    }
public function bulkDeleteAction ( Request $ request ) : Response { $ this -> denyAccessUnlessGranted ( new Attribute ( 'section' , 'edit' ) ) ; $ form = $ this -> formFactory -> deleteSections ( new SectionsDeleteData ( ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) ) { $ result = $ this -> submitHandler -> handle ( $ form , function ( SectionsDeleteData $ data ) { foreach ( $ data -> getSections ( ) as $ sectionId => $ selected ) { $ section = $ this -> sectionService -> loadSection ( $ sectionId ) ; $ this -> sectionService -> deleteSection ( $ section ) ; $ this -> notificationHandler -> success ( $ this -> translator -> trans ( /** @Desc("Section '%name%' removed.") */ 'section.delete.success' , [ '%name%' => $ section -> name ] , 'section' ) ) ; } } ) ; if ( $ result instanceof Response ) { return $ result ; } } return $ this -> redirect ( $ this -> generateUrl ( 'ezplatform.section.list' ) ) ; }
Handles removing sections based on submitted form.

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

@return \Symfony\Component\HttpFoundation\Response
Handles removing sections based on submitted form .