public function bulkDeleteAction(Request $request): Response
    {
        $form = $this->formFactory->deleteLanguages(
            new LanguagesDeleteData()
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (LanguagesDeleteData $data) {
                foreach ($data->getLanguages() as $languageId => $selected) {
                    $language = $this->languageService->loadLanguageById($languageId);
                    $this->languageService->deleteLanguage($language);

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

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

        return $this->redirect($this->generateUrl('ezplatform.language.list'));
    }
public function bulkDeleteAction(Request $request): Response
    {
        $form = $this->formFactory->deleteLanguages(
            new LanguagesDeleteData()
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (LanguagesDeleteData $data) {
                foreach ($data->getLanguages() as $languageId => $selected) {
                    $language = $this->languageService->loadLanguageById($languageId);
                    $this->languageService->deleteLanguage($language);

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

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

        return $this->redirect($this->generateUrl('ezplatform.language.list'));
    }
public function bulkDeleteAction ( Request $ request ) : Response { $ form = $ this -> formFactory -> deleteLanguages ( new LanguagesDeleteData ( ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) ) { $ result = $ this -> submitHandler -> handle ( $ form , function ( LanguagesDeleteData $ data ) { foreach ( $ data -> getLanguages ( ) as $ languageId => $ selected ) { $ language = $ this -> languageService -> loadLanguageById ( $ languageId ) ; $ this -> languageService -> deleteLanguage ( $ language ) ; $ this -> notificationHandler -> success ( $ this -> translator -> trans ( /** @Desc("Language '%name%' removed.") */ 'language.delete.success' , [ '%name%' => $ language -> name ] , 'language' ) ) ; } } ) ; if ( $ result instanceof Response ) { return $ result ; } } return $ this -> redirect ( $ this -> generateUrl ( 'ezplatform.language.list' ) ) ; }
Handles removing languages based on submitted form.

@param Request $request

@return Response

@throws UnauthorizedException
@throws InvalidOptionsException
@throws TranslationInvalidArgumentException
@throws InvalidArgumentException
@throws NotFoundException
@throws \InvalidArgumentException
Handles removing languages based on submitted form .