Delete the collection stamp

@param  Request                       $request The current request
@param  integer                       $bas_id  The collection base_id
@return Response
340119
public function deleteStamp(Request $request, $bas_id)
    {
        $success = false;

        $collection = \collection::getByBaseId($this->app, $bas_id);

        try {
            $this->app->getApplicationBox()->write_collection_pic(
                $this->app['media-alchemyst'],
                $this->app['filesystem'],
                $collection,
                null,
                \collection::PIC_STAMP
            );
            $success = true;
        } catch (\Exception $e) {

        }

        if ('json' === $request->getRequestFormat()) {
            return $this->app->json([
                'success' => $success,
                'msg'     => $success ? $this->app->trans('Successful removal') : $this->app->trans('An error occured'),
                'bas_id'  => $collection->get_base_id()
            ]);
        }

        return $this->app->redirectPath('admin_display_collection', [
            'bas_id'  => $collection->get_base_id(),
            'success' => (int) $success,
        ]);
    }
666470
public function doDeleteRecords(Request $request)
    {
        $flatten = (bool)($request->request->get('del_children')) ? RecordsRequest::FLATTEN_YES_PRESERVE_STORIES : RecordsRequest::FLATTEN_NO;
        $records = RecordsRequest::fromRequest(
            $this->app,
            $request,$flatten,
            [\ACL::CANDELETERECORD]
        );

        $basketElementsRepository = $this->getBasketElementRepository();
        $StoryWZRepository = $this->getStoryWorkZoneRepository();

        $deleted = [];

        /** @var \collection[] $trashCollectionsBySbasId */
        $trashCollectionsBySbasId = [];

        $manager = $this->getEntityManager();

        /** @var \record_adapter $record */
        foreach ($records as $record) {
            try {
                $basketElements = $basketElementsRepository->findElementsByRecord($record);

                foreach ($basketElements as $element) {
                    $manager->remove($element);
                    $deleted[] = $element->getRecord($this->app)->getId();
                }

                $attachedStories = $StoryWZRepository->findByRecord($this->app, $record);

                foreach ($attachedStories as $attachedStory) {
                    $manager->remove($attachedStory);
                }

                foreach($record->get_grouping_parents() as $story) {
                    $this->getEventDispatcher()->dispatch(PhraseaEvents::RECORD_EDIT, new RecordEdit($story));
                }

                $sbasId = $record->getDatabox()->get_sbas_id();
                if(!array_key_exists($sbasId, $trashCollectionsBySbasId)) {
                    $trashCollectionsBySbasId[$sbasId] = $record->getDatabox()->getTrashCollection();
                }
                $deleted[] = $record->getId();
                if($trashCollectionsBySbasId[$sbasId] !== null) {
                    if($record->getCollection()->get_coll_id() == $trashCollectionsBySbasId[$sbasId]->get_coll_id()) {
                        // record is already in trash so delete it
                        $record->delete();
                    } else {
                        // move to trash collection
                        $record->move_to_collection($trashCollectionsBySbasId[$sbasId], $this->getApplicationBox());
                        // disable permalinks
                        foreach($record->get_subdefs() as $subdef) {
                            if( ($pl = $subdef->get_permalink()) ) {
                                    $pl->set_is_activated(false);
                            }
                        }
                    }
                } else {
                    // no trash collection, delete
                    $record->delete();
                }
            } catch (\Exception $e) {
            }
        }

        $manager->flush();

        return $this->app->json($deleted);
    }
831044
public function rename(Request $request, $bas_id)
    {
        if (trim($name = $request->request->get('name')) === '') {
            $this->app->abort(400, $this->app->trans('Missing name parameter'));
        }

        $success = false;

        $collection = \collection::getByBaseId($this->app, $bas_id);

        try {
            $collection->set_name($name);
            $success = true;
        } catch (\Exception $e) {

        }

        if ('json' === $this->app['request']->getRequestFormat()) {
            return $this->app->json([
                'success' => $success,
                'msg'     => $success ? $this->app->trans('Successful update') : $this->app->trans('An error occured'),
            ]);
        }

        return $this->app->redirectPath('admin_display_collection', [
            'bas_id'      => $collection->get_base_id(),
            'success'     => (int) $success,
            'reload-tree' => 1,
        ]);
    }
1309716
public function delete(Request $request, Fractal $fractal)
    {
        $this->beforeRequest($request, func_get_args());
        $id = $this->parseObjectId($request);
        $model = $this->loadAuthorizeObject($id, 'delete');
        if (!$model->delete()) {
            return $this->respondWithError('Unable to delete the object', 500);
        }
        return $this->respondWithStatus(200);
    }
1368678
public function destroy(Request $request, $id)
    {
        $forceDelete = $request->get('force', false);

        $block = $this->repository->getByIdWithTrashed($id);

        if (!empty($block)) {
            $this->authorize('delete', $block);
            if ($forceDelete) {
                $this->repository->forceDelete($block);
            } else {
                $this->repository->delete($block);
            }
            return $this->respondWithSimpleSuccess(['success' => true]);
        }
        return $this->respondNotFound();
    }
388122
public function deleteAction(Request $request)
    {
        $gridSource = $this->get('dtc_grid.manager.source')->get($request->get('id'));
        $id = $request->get('identifier');
        $gridSource->remove($id);
        $response = new Response();
        $response->setStatusCode(204);

        return $response;
    }
401471
public function deleteBase(Request $request, $databox_id)
    {
        $databox = null;
        $success = false;
        $msg = $this->app->trans('An error occured');
        try {
            $databox = $this->findDataboxById($databox_id);

            if ($databox->get_record_amount() > 0) {
                $msg = $this->app->trans('admin::base: vider la base avant de la supprimer');
            } else {
                $databox->unmount_databox();
                $this->getApplicationBox()->write_databox_pic(
                    $this->app['media-alchemyst'],
                    $this->app['filesystem'],
                    $databox,
                    null,
                    \databox::PIC_PDF
                );
                $databox->delete();
                $success = true;
                $msg = $this->app->trans('Successful removal');
            }
        } catch (\Exception $e) {

        }
        if (!$databox) {
            $this->app->abort(404, $this->app->trans('admin::base: databox not found', ['databox_id' => $databox_id]));
        }

        if ('json' === $request->getRequestFormat()) {
            return $this->app->json([
                'success' => $success,
                'msg'     => $msg,
                'sbas_id' => $databox->get_sbas_id()
            ]);
        }

        $params = [
            'databox_id' => $databox->get_sbas_id(),
            'success'    => (int) $success,
        ];

        if ($databox->get_record_amount() > 0) {
            $params['error'] = 'databox-not-empty';
        }

        return $this->app->redirectPath('admin_database', $params);
    }
1079418
public function deleteAction(Request $request, $id)
    {
        $entity = $this->getRepository()->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find ' . $this->getEntityName() . '.');
        }

        $em = $this->getDoctrine()->getManager();

        $this->get('session')->getFlashBag()->add('success', ucfirst($this->getEntityName()) . ' has been deleted!');

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

        if ($request->getMethod() == "DELETE") {
            return new JsonResponse([
                'success' => true
            ]);
        } else {
            return $this->redirect($this->getRefererUrl());
        }
    }
1135422
public function deleteAction(Request $request, $id)
    {
        $this->isAllowed('BUSINESS_MANAGE_USER');

        $form = $this->createDeleteForm($id);

        if ($request->getMethod() == 'GET') {
            $userManager = $this->container->get('fos_user.user_manager');
            $entity = $userManager->findUserBy(array('id' => $id));

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find User entity.');
            }

            return $this->render(
                'CanalTPSamEcoreUserManagerBundle:User:delete.html.twig',
                array(
                    'entity'      => $entity,
                    'delete_form' => $form->createView(),
                )
            );
        } else {
            $form->bind($request);

            if ($form->isValid() && $this->isCurrentUser($id)) {
                $userManager = $this->container->get('sam.user_manager');
                $entity = $userManager->findUserBy(array('id' => $id));

                if (!$entity) {
                    throw $this->createNotFoundException('Unable to find User entity.');
                }

                $this->dispatchEvent($entity, SamCoreEvents::DELETE_USER);
                $userManager->deleteUser($entity);
            }

            return $this->redirect($this->generateUrl('sam_user_list'));
        }
    }
1141602
public function deleteAction(Request $request, $id)
    {
        $form = $this->createDeleteForm($id);
        $form->bind($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            /** @var Family $entity */
            $entity = $em->getRepository('EcommerceBundle:Tax')->find($id);

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find Tax entity.');
            }

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

            $this->get('session')->getFlashBag()->add('info', 'tax.deleted');
        }

        return $this->redirect($this->generateUrl('ecommerce_tax_index'));
    }
872627
public function deleteTemplate(Request $request, $id)
    {
        // Find Template
        $mailTemplate = $this
            ->getDoctrine()
            ->getRepository($this->getParameter('pd_mailer.mail_template_class'))
            ->findOneBy(['id' => $id]);

        // Not Found
        if (null === $mailTemplate) {
            $this->addFlash('error', 'sorry_not_existing');

            return $this->redirectToRoute('admin_mail_list');
        }

        // Remove Template
        $em = $this->getDoctrine()->getManager();
        $em->remove($mailTemplate);
        $em->flush();

        // Redirect Back
        return $this->redirect($request->headers->get('referer') ?? $this->generateUrl('admin_mail_list'));
    }
1229268
public function delete(Request $request)
    {
        // AUTHORIZE ... COMES HERE
        $status = $this->pageBlockRepository->deleteById($request->get('pageblock_id'));
        return $status;
    }
1285032
public function destroy(Request $request, $id)
    {
        if ($request->has('ids') && \is_array($request->get('ids'))) {
            foreach ($request->get('ids') as $id_item) {
                $this->destroyElement($request, $id_item);
            }
            Session::push('message.success', 'Удалено '.\count($request->get('ids')).' элементов');

            return back();
        }
        $this->destroyElement($request, $id);
        if ($request->has('category_item')) {
            return Redirect::to('/admin/'.$this->config->name.'/'.$request->get('category_item'));
        }
        if ($request->get('place') === 'material') {
            return Redirect::to('/admin/'.$this->config->name);
        }

        return back();
    }
197103
public function destroy(int $id, Request $request)
    {
        $storage = $request->get('storage', 'public');
        Attachment::find($id)->delete($storage);

        return response(200);
    }
1267461
public function setOrderAdmins(Request $request, $bas_id)
    {
        $admins = array_filter(
            array_values($request->request->get('admins', [])),
            function ($value) { return $value != false; }
        );

        if (false && count($admins) === 0) {
            $this->app->abort(400, 'No admins provided.');
        }

        if (!is_array($admins)) {
            $this->app->abort(400, 'Admins must be an array.');
        }

        $collection = $this->getApplicationBox()->get_collection($bas_id);
        $collectionReference = $collection->getReference();

        $this->collectionService->setOrderMasters($collectionReference, $admins);

        return $this->app->redirectPath('admin_display_collection', [
            'bas_id'  => $bas_id,
            'success' => 1,
        ]);
    }
544980
public function deleteCollectorResponse($collectorId, $responseId)
	{
		return $this->sendRequest(
			$this->createRequest('DELETE', sprintf('collectors/%s/responses/%s', $collectorId, $responseId))
		);
	}
628522
public function deleteAction($id, Request $request)
    {
        try {
            $mediaManager = $this->getMediaManager();

            $locale = $this->getLocale($request);

            $media = $mediaManager->getById($id, $locale);
            /** @var MediaInterface $mediaEntity */
            $mediaEntity = $media->getEntity();

            if (null !== $mediaEntity->getPreviewImage()) {
                $oldPreviewImageId = $mediaEntity->getPreviewImage()->getId();

                $mediaEntity->setPreviewImage(null);

                $mediaManager->delete($oldPreviewImageId);
            }

            $view = $this->view(null, 204);
        } catch (MediaNotFoundException $e) {
            $view = $this->view($e->toArray(), 404);
        } catch (MediaException $e) {
            $view = $this->view($e->toArray(), 400);
        }

        return $this->handleView($view);
    }