public function bulkDeleteAction(Request $request): Response
    {
        $this->denyAccessUnlessGranted(new Attribute('class', 'delete'));
        $form = $this->formFactory->deleteContentTypeGroups(
            new ContentTypeGroupsDeleteData()
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (ContentTypeGroupsDeleteData $data) {
                foreach ($data->getContentTypeGroups() as $contentTypeGroupId => $selected) {
                    $group = $this->contentTypeService->loadContentTypeGroup($contentTypeGroupId);
                    $this->contentTypeService->deleteContentTypeGroup($group);

                    $this->notificationHandler->success(
                        $this->translator->trans(
                            /** @Desc("Content type group '%name%' deleted.") */
                            'content_type_group.delete.success',
                            ['%name%' => $group->identifier],
                            'content_type'
                        )
                    );
                }
            });

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

        return $this->redirect($this->generateUrl('ezplatform.content_type_group.list'));
    }
public function bulkDeleteAction(Request $request): Response
    {
        $this->denyAccessUnlessGranted(new Attribute('class', 'delete'));
        $form = $this->formFactory->deleteContentTypeGroups(
            new ContentTypeGroupsDeleteData()
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (ContentTypeGroupsDeleteData $data) {
                foreach ($data->getContentTypeGroups() as $contentTypeGroupId => $selected) {
                    $group = $this->contentTypeService->loadContentTypeGroup($contentTypeGroupId);
                    $this->contentTypeService->deleteContentTypeGroup($group);

                    $this->notificationHandler->success(
                        $this->translator->trans(
                            /** @Desc("Content type group '%name%' deleted.") */
                            'content_type_group.delete.success',
                            ['%name%' => $group->identifier],
                            'content_type'
                        )
                    );
                }
            });

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

        return $this->redirect($this->generateUrl('ezplatform.content_type_group.list'));
    }
public function bulkDeleteAction ( Request $ request ) : Response { $ this -> denyAccessUnlessGranted ( new Attribute ( 'class' , 'delete' ) ) ; $ form = $ this -> formFactory -> deleteContentTypeGroups ( new ContentTypeGroupsDeleteData ( ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) ) { $ result = $ this -> submitHandler -> handle ( $ form , function ( ContentTypeGroupsDeleteData $ data ) { foreach ( $ data -> getContentTypeGroups ( ) as $ contentTypeGroupId => $ selected ) { $ group = $ this -> contentTypeService -> loadContentTypeGroup ( $ contentTypeGroupId ) ; $ this -> contentTypeService -> deleteContentTypeGroup ( $ group ) ; $ this -> notificationHandler -> success ( $ this -> translator -> trans ( /** @Desc("Content type group '%name%' deleted.") */ 'content_type_group.delete.success' , [ '%name%' => $ group -> identifier ] , 'content_type' ) ) ; } } ) ; if ( $ result instanceof Response ) { return $ result ; } } return $ this -> redirect ( $ this -> generateUrl ( 'ezplatform.content_type_group.list' ) ) ; }
Handles removing content type groups based on submitted form.

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

@return \Symfony\Component\HttpFoundation\Response
Handles removing content type groups based on submitted form .