Controller for deleting material image from gallery
@param string $imageId Gallery Image identifier
@return array Async response array
337942
public function __async_delete($imageId, $materialFieldID = null)
    {
        // Async response
        $result = array();

        /** @var \samson\activerecord\gallery $image */
        $image = null;

        // Find gallery record in DB
        if ($this->findAsyncEntityByID($imageId, $image, $result)) {
            if ($image->Path != '') {
                // Get image path
                $imagePath = $this->formImagePath($image->Path, $image->Src);
                // Physically remove file from server
                if ($this->imageExists($imagePath)) {
                    $this->fs->delete($imagePath);
                }

                // Delete thumbnails
                if (class_exists('\samson\scale\ScaleController', false)) {
                    /** @var \samson\scale\ScaleController $scale */
                    $scale = $this->system->module('scale');

                    foreach (array_keys($scale->thumnails_sizes) as $folder) {
                        // Form image path for scale module
                        $imageScalePath = $this->formImagePath($image->Path . $folder . '/', $image->Src);
                        if ($this->imageExists($imageScalePath)) {
                            $this->fs->delete($imageScalePath);
                        }
                    }
                }
            }

            // Remove record from DB
            $image->delete();
        }

        return $this->__async_update($materialFieldID);
    }
748503
public function deleteImage($productId)
    {
        $productId = (int) $productId;

        if ($productId == 0 || $productId == '') {
            $message = 'Product ID not correct: ' . $productId;
            $this->log($message);
            die(json_encode([
                'status' => 0,
                'msg' => $message
            ]));
        }

        $product = $this->Product->find('all', [
            'conditions' => [
                'Products.id_product' => $productId
            ],
            'contain' => [
                'Images',
                'Manufacturers'
            ]
        ])->first();
        
        $this->Product->changeImage(
            [
                [$productId => 'no-image']
            ]
        );

        $actionLogMessage = __d('admin', 'Image_ID_{0}_from_manufacturer_{1}_was_deleted_successfully_Product_{1}_Manufacturer_{2}.', [
            $product->image->id_image,
            '<b>' . $product->name . '</b>',
            '<b>' . $product->manufacturer->name . '</b>'
        ]);

        $this->Flash->success($actionLogMessage);
        $this->ActionLog->customSave('product_image_deleted', $this->AppAuth->getUserId(), $productId, 'products', $actionLogMessage);

        $this->getRequest()->getSession()->write('highlightedRowId', $productId);

        $this->redirect($this->referer());
    }
621824
public function removeImage($imageGuid)  {
		$imageList = $this->getImageList();
		$key = array_search($imageGuid, $imageList);
		if ($key === false) {
			return false;
		}

		unset($imageList[$key]);
		$this->setImageList($imageList);

		return true;
	}
658921
public function actionDelete($templateId)
    {
        if($template = EmailTemplate::findOne($templateId)) {
            $template->delete();
        }

        return $this->redirect(Url::toRoute('list'));
    }
124740
public function deleteAction($folderId)
    {
        $folder = $this->get('open_orchestra_media.repository.media_folder')->find($folderId);
        if ($folder) {
            $this->denyAccessUnlessGranted(ContributionActionInterface::DELETE, $folder);
            $folderManager = $this->get('open_orchestra_media_admin.manager.media_folder');

            if (!$this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $folder)) {
                throw new FolderNotDeletableException();
            }
            $folderManager->deleteFolder($folder);

            $event = $this->get("open_orchestra_media_admin.event.folder_event");
            $event->setFolder($folder);
            $this->dispatchEvent(FolderEvents::FOLDER_DELETE, $event);
            $this->get('object_manager')->flush();
        }

        return array();
    }
339624
public function delete(Resource\ResourceId $resourceId)
    {
        $this->crudRepositoryAdapter->deleteResource($this->resourceType, $resourceId);
    }
655769
public function deleteAction($siteId)
    {
        $site = $this->get('open_orchestra_model.repository.site')->findOneBySiteId($siteId);
        $this->denyAccessUnlessGranted(ContributionActionInterface::DELETE, $site);

        if ($site instanceof SiteInterface) {
            $site->setDeleted(true);
            $this->dispatchEvent(SiteEvents::SITE_DELETE, new SiteEvent($site));
            $this->get('object_manager')->flush();
        }

        return array();
    }
124218
public function delete($id = null)
    {
        if (is_null($id) || is_array($id)) {
            return $this->deleteMany($id);
        }

        $response = $this->ontraport->delete(
            $this->getSingularNamespace(), $this->toArray(compact('id'))
        );

        return $this->ontraport->item($this, $response);
    }
1370505
public function delete($boxId, $messageId, $documentId = null)
    {
        $this->doRequest(
            self::RESOURCE_DELETE,
            [
                'boxId' =>  $boxId,
                'messageId' => $messageId,
                'documentId' => $documentId
            ],
            self::METHOD_POST
        );

        return true;
    }
281875
public function actionDeleteImage(int $id, string $imageType)
    {
        $this->trigger(self::EVENT_BEFORE_EDIT_CATEGORY, new CategoryEvent());

        $category = Category::findOne($id);

        if (\Yii::$app->shop_imagable->delete('shop-category/' . $imageType, $category->$imageType)) {
            $category->$imageType = null;
            $category->save();
            Yii::$app->getSession()->setFlash('success', 'The image has been successfully deleted.');
            $this->trigger(self::EVENT_AFTER_EDIT_CATEGORY, new CategoryEvent(['id' => $id]));
        } else Yii::$app->getSession()->setFlash('error', 'Error deleting image.');

        return $this->redirect(\Yii::$app->request->referrer);
    }
511708
public function iconSetDeleteAction($id)
    {
        $iconSet = $this->iconSetManager->getIconSetById($id);
        if (null !== $iconSet) {
            $this->iconSetManager->deleteIconSet($iconSet);
        }

        return new JsonResponse(['deleted' => true]);
    }
872650
public function batchDelete(array $UserID)
    {
        $params = array(
                   'useridlist' => $UserID,
                  );
        return $this->http->jsonPost(self::API_BATCH_DELETE, $params);

    }
1130409
public function deleteAction($mediaId)
    {
        $media = $this->get('open_orchestra_media.repository.media')->find($mediaId);
        $this->denyAccessUnlessGranted(ContributionActionInterface::DELETE, $media);

        if ($media instanceof MediaInterface) {
            if (!$this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $media)) {
                throw new MediaNotDeletableException();
            }
            $documentManager = $this->get('object_manager');
            $documentManager->remove($media);
            $documentManager->flush();
            $this->dispatchEvent(MediaEvents::MEDIA_DELETE, new MediaEvent($media));
        }

        return array();
    }
944845
public function removeAction($mediaId)
    {
        $media = $this->getMedia($mediaId);
        $request = $this->getRequest();
        if ($request->request->get('confirm') === 'yes' || $request->get('confirm') === 'yes')
        {
            $this->get('fulgurio_light_cms.media_library')->remove($media);
            $em = $this->getDoctrine()->getManager();
            $em->remove($media);
            $em->flush();
            return $this->redirect($this->generateUrl('AdminMedias'));
        }
        else if ($request->request->get('confirm') === 'no')
        {
            return $this->redirect($this->generateUrl('AdminMedias', array('mediaId' => $mediaId)));
        }
        $templateName = $request->isXmlHttpRequest() ? 'FulgurioLightCMSBundle::adminConfirmAjax.html.twig' : 'FulgurioLightCMSBundle::adminConfirm.html.twig';
        return $this->render($templateName, array(
            'action' => $this->generateUrl('AdminMediasRemove', array('mediaId' => $mediaId)),
            'confirmationMessage' => $this->get('translator')->trans('fulgurio.lightcms.medias.delete_confirm_message', array('%FILENAME%' => $media->getOriginalName()), 'admin'),
        ));
    }
979646
public function destroy($fieldId)
    {
        $field = $this->resourceField->find($fieldId);

        $field->delete();

        return response()->json(['status' => 'ok']);
    }
365347
public function delete($docId)
    {
        return $this->montage->request(
            'delete',
            $this->montage->url('document-detail', $this->schema->name, $docId)
        );
    }
155041
public function delMaterial($media_id)
    {
        $url = "https://api.weixin.qq.com/cgi-bin/material/del_material?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['media_id' => $media_id]);
    }