@param Request $request

@Config\Route("/delete-multiple-version", name="open_orchestra_api_content_delete_multiple_versions")
@Config\Method({"DELETE"})

@return Response
420476
public function deleteContentVersionsAction(Request $request)
    {
        $format = $request->get('_format', 'json');
        $facade = $this->get('jms_serializer')->deserialize(
            $request->getContent(),
            $this->getParameter('open_orchestra_api.facade.content_collection.class'),
            $format
        );
        $contents = $this->get('open_orchestra_api.transformer_manager')->reverseTransform('content_collection', $facade);
        $storageIds = array();
        foreach ($contents as $content) {
            if ($this->isGranted(ContributionActionInterface::DELETE, $content) &&
                $this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(ContentStrategy::DELETE_VERSION, $content)
            ) {
                $storageIds[] = $content->getId();
                $this->dispatchEvent(ContentEvents::CONTENT_DELETE_VERSION, new ContentEvent($content));
            }
        }
        if (!empty($storageIds)) {
            $this->get('open_orchestra_model.repository.content')->removeContentVersion($storageIds);
        }

        return array();
    }
1034350
public function deleteAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();
        $submission = $em->getRepository('KunstmaanFormBundle:FormSubmission')->find($id);

        $node = $em->getRepository('KunstmaanNodeBundle:Node')->find($submission->getNode());
        $nt = $node->getNodeTranslation($request->getLocale());

        $this->denyAccessUnlessGranted(PermissionMap::PERMISSION_DELETE, $node);

        $url = $this->get('router')->generate(
            'KunstmaanFormBundle_formsubmissions_list',
            ['nodeTranslationId' => $nt->getId()]
        );

        $fields = $em->getRepository('KunstmaanFormBundle:FormSubmissionField')->findBy(['formSubmission' => $submission]);

        try {
            foreach ($fields as $field) {
                $em->remove($field);
            }

            $em->remove($submission);
            $em->flush();

            $this->addFlash(
                FlashTypes::SUCCESS,
                $this->get('translator')->trans('formsubmissions.delete.flash.success')
            );
        } catch (\Exception $e) {
            $this->get('logger')->error($e->getMessage());
            $this->addFlash(
                FlashTypes::ERROR,
                $this->get('translator')->trans('formsubmissions.delete.flash.error')
            );
        }

        $response = new RedirectResponse($url);

        return $response;
    }
935235
public function editAction(Request $request): Response
    {
        /* @todo it shouldn't rely on keys from request */
        $requestKeys = $request->request->keys();
        $formName = reset($requestKeys) ?: null;

        $form = $this->formFactory->contentEdit(null, $formName);
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (ContentEditData $data) {
                $contentInfo = $data->getContentInfo();
                $versionInfo = $data->getVersionInfo();
                $language = $data->getLanguage();
                $versionNo = $versionInfo->versionNo;
                $location = $data->getLocation();

                $content = $this->contentService->loadContent($contentInfo->id);
                if ((new ContentIsUser($this->userService))->isSatisfiedBy($content)) {
                    return $this->redirectToRoute('ez_user_update', [
                        'contentId' => $contentInfo->id,
                        'versionNo' => $versionNo,
                        'language' => $language->languageCode,
                    ]);
                }

                if (!$versionInfo->isDraft()) {
                    $contentDraft = $this->contentService->createContentDraft($contentInfo, $versionInfo);
                    $this->updateDraftInitialLanguage($contentDraft, $language);
                    $versionNo = $contentDraft->getVersionInfo()->versionNo;

                    $this->notificationHandler->success(
                        $this->translator->trans(
                            /** @Desc("New Version Draft for '%name%' created.") */
                            'content.create_draft.success',
                            ['%name%' => $contentInfo->name],
                            'content'
                        )
                    );
                }

                return $this->redirectToRoute('ez_content_draft_edit', [
                    'contentId' => $contentInfo->id,
                    'versionNo' => $versionNo,
                    'language' => $language->languageCode,
                    'locationId' => null !== $location
                        ? $location->id
                        : $contentInfo->mainLocationId,
                ]);
            });

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

        /** @var ContentEditData $data */
        $data = $form->getData();
        $contentInfo = $data->getContentInfo();

        if (null !== $contentInfo) {
            return $this->redirectToRoute('_ezpublishLocation', [
                'locationId' => $contentInfo->mainLocationId,
            ]);
        }

        return $this->redirectToRoute('ezplatform.dashboard');
    }
67864
public function deleteModuleSettings(ServerRequestInterface $request): ResponseInterface
    {
        $module_name = $request->getParsedBody()['module_name'];

        DB::table('block_setting')
            ->join('block', 'block_setting.block_id', '=', 'block.block_id')
            ->join('module', 'block.module_name', '=', 'module.module_name')
            ->where('module.module_name', '=', $module_name)
            ->delete();

        DB::table('block')
            ->join('module', 'block.module_name', '=', 'module.module_name')
            ->where('module.module_name', '=', $module_name)
            ->delete();

        DB::table('module_setting')
            ->where('module_name', '=', $module_name)
            ->delete();

        DB::table('module_privacy')
            ->where('module_name', '=', $module_name)
            ->delete();

        DB::table('module')
            ->where('module_name', '=', $module_name)
            ->delete();

        FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been deleted.', $module_name), 'success');

        return redirect(route('modules'));
    }
334264
public function send(Request $request)
    {
        $response      = new DeleteIndexResponse();
        $rpbDeleteReq  = $this->createRpbMessage($request);

        $this->client->send($rpbDeleteReq, RiakMessageCodes::YOKOZUNA_INDEX_DELETE_REQ, RiakMessageCodes::DEL_RESP);

        return $response;
    }
398523
public function deleteMediasAction(Request $request)
    {
        $format = $request->get('_format', 'json');

        $facade = $this->get('jms_serializer')->deserialize(
            $request->getContent(),
            $this->getParameter('open_orchestra_media_admin.facade.media_collection.class'),
            $format
            );

        $mediaRepository = $this->get('open_orchestra_media.repository.media');
        $medias = $this->get('open_orchestra_api.transformer_manager')->reverseTransform('media_collection', $facade);

        $mediasIds = array();
        foreach ($medias as $media) {
            if ($this->isGranted(ContributionActionInterface::DELETE, $media) &&
                $this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $media)) {
                $mediasIds[] = $media->getId();
                $this->dispatchEvent(MediaEvents::MEDIA_DELETE, new MediaEvent($media));
            }
        }
        $mediaRepository->removeMedias($mediasIds);

        return array();
    }
891952
public function repeaterEntriesDelete(Request $request)
    {
        // AUTHORIZE ... COMES HERE
        $status = $this->content->deleteById($request->get('repeater_id'));
        return $status;
    }
1334882
public function deleteAction(Request $request, $id)
    {
        $this->checkAccess('DELETE', $id);
        $resource = $this->getResourceManager()->find($id);
        $this->getResourceManager()->remove($resource);
        $view = $this->view(null, \FOS\RestBundle\Util\Codes::HTTP_OK);
        return $this->handleView($view);
    }
396418
public function removeAction(Request $request): Response
    {
        $form = $this->formFactory->removeContentDraft();
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (ContentRemoveData $data) {
                foreach (array_keys($data->getVersions()) as $version) {
                    $versionId = VersionId::fromString($version);

                    $this->contentService->deleteVersion(
                        $this->contentService->loadVersionInfoById(
                            $versionId->getContentId(),
                            $versionId->getVersionNo()
                        )
                    );
                }

                return $this->redirectToRoute('ezplatform.content_draft.list');
            });

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

        return $this->redirectToRoute('ezplatform.content_draft.list');
    }
203991
public function deleteAction(Request $request)
    {
        $fileId = $request->get('file_id');
        $fileIds = explode(',', $fileId);

        $volumeManager = $this->get('phlexible_media_manager.volume_manager');

        foreach ($fileIds as $fileId) {
            try {
                $volume = $volumeManager->getByFileId($fileId);
                $file = $volume->findFile($fileId);
                $volume->deleteFile($file, $this->getUser()->getId());
            } catch (NotFoundException $e) {
            }
        }

        return new ResultResponse(true, count($fileIds).' file(s) deleted.');
    }
1048340
public function deleteAction(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            throw new NotFoundHttpException();
        }

        $folder = $this->findFolderById($request->attributes->get('id'));

        $result = array();
        try {
            $this->removeFolder($folder);
        } catch (DBALException $e) {
            $result = array(
                'error'   => true,
                'message' => 'Ce dossier n\'est pas vide.',
            );
        }

        $response = new Response(json_encode($result, JSON_FORCE_OBJECT));
        $response->headers->add(array('Content-Type' => 'application/json'));
        return $response;
    }
65931
public function deleteAction(Request $request)
    {
        $id = $request->get('id');

        $elementtypeService = $this->get('phlexible_elementtype.elementtype_service');
        $elementtype = $elementtypeService->findElementtype($id);

        $elementtypeService->deleteElementtype($elementtype);

        return new ResultResponse(true, "Element type $id soft deleted.");
    }
833995
public function delete(Request $request)
    {
        $this->validate(request(), [//@todo create custom Request class for page validation
            'page_id' => 'required',
        ]);
        
        $status = $this->page->deleteById($request->get('page_id'));
        return $status;
    }
1299657
public function bulkDelete(Request $request)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('Permissions', 'delete')) {
            return $this->noPermission();
        }
        $data = $request->all();
        if(isset($data['postTypes'])) {
            unset($data['postTypes']);
        }

        DB::statement('SET FOREIGN_KEY_CHECKS=0');
        foreach ($data as $id){
            $page = \App\Models\UserGroup::findOrFail($id)->delete();
            if (!$page) {
                return $this->response('Internal server error. Please try again later', 500);
            }
            DB::table('permissions')->where('groupID', $id)->delete();
        }

        return $this->response('Groups are deleted');
    }
417491
public function removeAction(Request $request): Response
    {
        $isDraftForm = null !== $request->get(
            sprintf('version-remove-%s', VersionsTab::FORM_REMOVE_DRAFT)
        );

        $formName = $isDraftForm
            ? sprintf('version-remove-%s', VersionsTab::FORM_REMOVE_DRAFT)
            : sprintf('version-remove-%s', VersionsTab::FORM_REMOVE_ARCHIVED);

        $form = $this->formFactory->removeVersion(
            new VersionRemoveData(),
            $formName
        );
        $form->handleRequest($request);

        /** @var ContentInfo $contentInfo */
        $contentInfo = $form->getData()->getContentInfo();
        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (VersionRemoveData $data) {
                $contentInfo = $data->getContentInfo();

                foreach ($data->getVersions() as $versionNo => $selected) {
                    $versionInfo = $this->contentService->loadVersionInfo($contentInfo, $versionNo);
                    $this->contentService->deleteVersion($versionInfo);
                }

                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("Versions removed from '%name%' content.") */
                        'version.delete.success',
                        ['%name%' => $contentInfo->name],
                        'version'
                    )
                );

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

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

        return $this->redirect($this->generateUrl('_ezpublishLocation', [
            'locationId' => $contentInfo->mainLocationId,
            '_fragment' => VersionsTab::URI_FRAGMENT,
        ]));
    }
760647
public function newAction(Request $request)
    {
        $groupClass = $this->getParameter('open_orchestra_user.document.group.class');
        /** @var GroupInterface $group */
        $group = new $groupClass();
        $siteId = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getSiteId();
        $group->setSite($this->get('open_orchestra_model.repository.site')->findOneBySiteId($siteId));

        $this->denyAccessUnlessGranted(ContributionActionInterface::CREATE, $group);

        $form = $this->createForm('oo_group', $group, array(
            'action'   => $this->generateUrl('open_orchestra_group_new'),
            'creation' => true,
            'method'   => 'POST'
        ));

        $form->handleRequest($request);

        if ($form->isValid()) {
            $documentManager = $this->get('object_manager');
            $documentManager->persist($group);
            $documentManager->flush();
            $message = $this->get('translator')->trans('open_orchestra_group.form.group.new.success');
            $this->get('session')->getFlashBag()->add('success', $message);

            $this->dispatchEvent(GroupEvents::GROUP_CREATE, new GroupEvent($group));
            $response = new Response(
                '',
                Response::HTTP_CREATED,
                array('Content-type' => 'text/plain; charset=utf-8', 'groupId' => $group->getId(), 'name' => $group->getName())
            );

            return $response;
        }

        return $this->renderAdminForm($form);
    }
1167741
public function confirmDeletionMultipleRows(Request $request) {

        $checkboxes = $request->input('checkbox');

        if (!$checkboxes) {
            // flash message with redirect
            Session::flash('status_code', 400 );
            $message = 'You have not selected any rows for deletion.';
            Session::flash('message', $message);
            return Redirect::route('admin.'.$this->model->resource_route_name.'.index');
        }


        // Prepare array of records

        // i) flatten the array (https://laravel.com/docs/5.1/helpers#method-array-flatten)
        $flattenedChecklistArray = array_flatten($checkboxes);

        // ii) find multiple records
        $records = $this->model->findMany($flattenedChecklistArray);

        return view('formhandling::adminformhandling/' . config('lasallecmsadmin.admin_template_name') . '/delete_confirmMultipleRows',
            [
                'user'                         => Auth::user(),
                'repository'                   => $this->repository,
                'records'                      => $records,
                'package_title'                => $this->model->package_title,
                'table_name'                   => $this->model->table,
                'model_class'                  => $this->model->model_class,
                'checkboxes'                   => $checkboxes,
                'resource_route_name'          => $this->model->resource_route_name,
                'HTMLHelper'                   => HTMLHelper::class,
                'Config'                       => Config::class,
                'Form'                         => Form::class,
            ]);
    }