@param Request $request

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

@return Response
198582
public function deleteContentsAction(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);
        $repository = $this->get('open_orchestra_model.repository.content');

        foreach ($contents as $content) {
            $this->denyAccessUnlessGranted(ContributionActionInterface::DELETE, $content);
            $contentId = $content->getContentId();
            if (
                $this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $content) &&
                $this->isGranted(ContributionActionInterface::DELETE, $content)
            ) {
                $repository->softDeleteContent($contentId);
                $this->dispatchEvent(ContentEvents::CONTENT_DELETE, new ContentDeleteEvent($contentId, $content->getSiteId()));
            }
        }

        return array();
    }
532930
public function deleteWorkflowProfilesAction(Request $request)
    {
        $format = $request->get('_format', 'json');
        $facade = $this->get('jms_serializer')->deserialize(
            $request->getContent(),
            $this->getParameter('open_orchestra_workflow_admin.facade.workflow_profile_collection.class'),
            $format
        );
        $workflowProfiles = $this->get('open_orchestra_api.transformer_manager')->reverseTransform('workflow_profile_collection', $facade);
        $workflowProfileIds = array();
        foreach ($workflowProfiles as $workflowProfile) {
            if ($this->isGranted(ContributionActionInterface::DELETE, $workflowProfile)) {
                $workflowProfileIds[] = $workflowProfile->getId();
                $this->dispatchEvent(WorkflowProfileEvents::WORKFLOW_PROFILE_DELETE, new WorkflowProfileEvent($workflowProfile));
            }
        }

        $workflowProfileRepository = $this->get('open_orchestra_model.repository.workflow_profile');
        $workflowProfileRepository->removeWorkflowProfiles($workflowProfileIds);

        return array();
    }
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();
    }
1181150
public function deleteAction(Request $request)
    {
        $teaserId = $request->get('teaser_id');

        $teaserManager = $this->get('phlexible_teaser.teaser_manager');

        $teaser = $teaserManager->find($teaserId);

        $teaserManager->deleteTeaser($teaser, $this->getUser()->getId());

        return new ResultResponse(true, "Teaser {$teaser->getId()} deleted.");
    }
12585
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'));
    }
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);
    }
99438
public function bulkDelete(Request $request)
    {
        if(!User::hasAccess('Language', 'delete')) {
            return $this->noPermission();
        }

        // Ensure a selection has taken place
        if (count($request->all()) <= 0) {
            return $this->response('Please select some languages to be deleted', 500);
        }

        $allPostTypes = PostType::all();

        // loop through language IDs
        foreach ($request->all() as $id) {
            $language = Language::find($id);

            if ($language->isDefault) {
                return $this->response("You can't delete the default language!", 403);
            }

            if(!$language->delete()) {
                return $this->response('The language '.$language->languageID.' was not deleted so the deleting process has stopped. Please try again later', 500);
            }else{
                // create virutal column for slug of every post type in the created language
                foreach ($allPostTypes as $postType){
                    AccioQuery::deleteColumn($postType->slug, "slug_".$language->slug);
                }

                $this->deleteDirectory($language->slug);
            }
        }
        return $this->response('Languages are deleted');
    }
1021679
public function bulkDelete(Request $request)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('Tags', 'delete')) {
            return $this->noPermission();
        }

        // if there are no item selected
        if (count($request->all()) <= 0) {
            return $this->response('Please select items to be deleted', 500);
        }
        // loop throw the item array (ids) and delete them
        foreach ($request->all() as $id) {
            $tagDeleteRes = $this->deleteTag($id);
            if(gettype($tagDeleteRes) == "boolean") {
                if(!$tagDeleteRes) {
                    return $this->response('Tag could not be deleted.', 500);
                }
            }else{
                return $tagDeleteRes;
            }
        }
        return $this->response('Selected tags are successfully deleted');
    }
764262
public function bulkDelete(Request $request)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('Categories', 'delete')) {
            return $this->noPermission();
        }

        // if there are no item selected
        if (count($request->all()) <= 0) {
            return $this->response('Please select items to be deleted', 500);
        }

        // loop throw the items
        foreach ($request->all() as $id) {
            $categoryDeleteRes = $this->deleteCategory($id);
            if(gettype($categoryDeleteRes) == "boolean") {
                if(!$categoryDeleteRes) {
                    return $this->response('Category could not be deleted.', 500);
                }
            }else{
                return $categoryDeleteRes;
            }
        }

        return $this->response('Selected categories are successfully deleted');
    }
89210
public function entriesDeleteAction(Request $request)
    {
        $entries = [];
        $serializedEntries = [];
        $entriesParams = $this->decodeIdsString($request, 'Claroline\ClacoFormBundle\Entity\Entry');

        foreach ($entriesParams as $entryParam) {
            if (!$entryParam->isLocked()) {
                $entries[] = $entryParam;
            }
        }
        foreach ($entries as $entry) {
            $this->clacoFormManager->checkEntryEdition($entry);
            $serializedEntries[] = $this->entrySerializer->serialize($entry);
        }
        $this->clacoFormManager->deleteEntries($entries);

        return new JsonResponse($serializedEntries, 200);
    }
909930
public function deleteStatusesAction(Request $request)
    {
        $format = $request->get('_format', 'json');

        $facade = $this->get('jms_serializer')->deserialize(
            $request->getContent(),
            $this->getParameter('open_orchestra_workflow_admin.facade.status_collection.class'),
            $format
        );
        $statusRepository = $this->get('open_orchestra_model.repository.status');
        $statuses = $this->get('open_orchestra_api.transformer_manager')->reverseTransform('status_collection', $facade);

        $statusIds = array();
        foreach ($statuses as $status) {
            if ($this->isDeleteGranted($status)) {
                $statusIds[] = $status->getId();
                $this->dispatchEvent(StatusEvents::STATUS_DELETE, new StatusEvent($status));
            }
        }
        $statusRepository->removeStatuses($statusIds);

        return array();
    }
493708
public function deleteAction(Request $request)
    {
        $this->mapper->delete($this->mapper->getResource($request->get('id')));

        return new Response('', 204);
    }
91422
public function multipledeleteinfoAction(Request $request)
    {
        $ids = $request->get('ids');

        $response = [];
        $numContacts = 0;
        $numChildren = 0;

        foreach ($ids as $id) {
            $account = $this->getRepository()->countDistinctAccountChildrenAndContacts($id);

            // Get number of subaccounts.
            $numChildren += $account['numChildren'];

            // FIXME: Distinct contacts: (currently the same contacts could be counted multiple times).
            // Get full number of contacts.
            $numContacts += $account['numContacts'];
        }

        $response['numContacts'] = $numContacts;
        $response['numChildren'] = $numChildren;

        $view = $this->view($response, 200);

        return $this->handleView($view);
    }
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;
    }
602993
public function duplicateAction(Request $request)
    {
        $this->denyAccessUnlessGranted(ContributionActionInterface::CREATE, GroupInterface::ENTITY_TYPE);

        $format = $request->get('_format', 'json');
        $facade = $this->get('jms_serializer')->deserialize(
            $request->getContent(),
            $this->getParameter('open_orchestra_group.facade.group.class'),
            $format
        );

        $group = $this->get('open_orchestra_api.transformer_manager')->reverseTransform('group', $facade);

        $newGroup = clone $group;

        $currentSiteId = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getSiteId();
        $currentSite = $this->get('open_orchestra_model.repository.site')->findOneBySiteId($currentSiteId);

        $newGroup->setWorkflowProfileCollections($group->getWorkflowProfileCollections());
        if ($newGroup->getSite()->getId() === $currentSite->getId()) {
            $newGroup->setPerimeters($group->getPerimeters());
        }
        $newGroup->setSite($currentSite);

        $objectManager = $this->get('object_manager');
        $objectManager->persist($newGroup);
        $objectManager->flush();

        return array();
    }
687888
public function delete(Request $request, $page)
    {
        // Set roles that have access
        $request->user()->authorizeRoles(['admin', 'editor']);

        $page = Page::withTrashed()->findOrFail($page);
        return view('page::pages.delete', ['page' => $page]);
    }
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);
    }