Удаляет информационный блок по его идентификатору или коду.

@param string $id

@return array

@throws \marvin255\bxmigrate\migrate\Exception
19974
protected function IblockDelete($id)
    {
        $return = [];
        $iblock = $this->iblockLocate($id);
        if (CIBlock::Delete($iblock['ID'])) {
            $return[] = "Iblock {$iblock['CODE']}({$iblock['ID']}) deleted";
        } else {
            throw new Exception("Can't delete {$iblock['CODE']}({$iblock['ID']}) iblock");
        }

        return $return;
    }
1011846
public function delete($id) {

		$bean = \R::findOne( $this->type, ' id = :id ', [ ':id' => $id ] );
		if ( !$bean ) {
			throw new \Exception('This '.$this->type.' does not exist.');
		}

		// Check for property type specific delete methods
		foreach ( $this->properties as $property ) {

			// Check if specific delete property method exists
			$c = new $property['type'];
			if ( method_exists( $c, 'delete' ) ) {
				$c->delete( $bean, $property );
			}

		}

		\R::trash( $bean );

	}
1269293
public function exportById($id): array
    {
        $field = Craft::$app->fields->getFieldById((int) $id);

        return $this->export($field);
    }
534989
public function deletePublicKey(int $id): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/user/keys/:id', (string)$id),
            Request::METHOD_DELETE);
    }
416693
protected static function doDelete($id)
    {
        $model = self::createModelInstance();
        $tableName = $model->getTableName($model->className);

        $connection = Connection::connect();

        $delete = $connection->prepare('delete from '.$tableName.' where id ='.$id);
        return $delete->execute() ? 'deleted successfully' : 'Row not deleted';

         
    }
785466
public function deleteRecords($id)
    {
        if (is_array($id)) {
            $params['idlist'] = implode(';', $id);
        } else {
            $params['id'] = $id;
        }

        return $this->call('deleteRecords', $params);
    }
101956
public function actionRemove($id)
    {
        $items = Yii::$app->getRequest()->post('items', []);
        $model = $this->findModel($id);
        $success = $model->removeChildren($items);
        Yii::$app->getResponse()->format = 'json';

        return array_merge($model->getItems(), ['success' => $success]);
    }
752542
public function exportById($id): array
    {
        $section = Craft::$app->sections->getSectionById((int) $id);

        return $this->export($section);
    }
1025957
public function destroy($id)
    {
        $post = $this->tagRepo->findOrFail($id);
        $post->delete();

        $message = 'El registro se eliminó satisfactoriamente.';

        return [
            'message' => $message
        ];
    }
89642
public function actionRemove($id)
    {
        $request = \Yii::$app->request;
        if ($request->getIsOptions()) {
            return $this->ResponseOptions($this->verbs()['remove']);
        }
        $items = Yii::$app->getRequest()->post('items', []);
        $model = $this->findModel($id);
        $success = $model->removeChildren($items);

        return array_merge($model->getItems(), ['success' => $success]);
    }
795701
public function remove($id)
    {
        // Support removing many ids at once
        $ids = Request::has('ids') ? explode(',', request('ids')) : [$id];

        // Get the model instances for each id, for the purpose of event firing
        $items = array_map(function ($id) {
            return $this->findOrFail($id);
        }, $ids);

        // Lookup up the parent model so we can bulk remove multiple of THIS model
        foreach ($items as $item) {
            $item->fireDecoyEvent('removing', [$item, $this->parent]);
        }
        $this->parentRelation()->detach($ids);
        foreach ($items as $item) {
            $item->fireDecoyEvent('removed', [$item, $this->parent]);
        }

        // Redirect.  We can use back cause this is never called from a "show"
        // page like get_delete is.
        if (Request::ajax()) {
            return Response::json();
        }

        return Redirect::back();
    }
451088
public function delete($id)
	{
		$this->getResponse()
			->setStatusCode(Response::STATUS_CODE_200);
		
		$request = $this->getRequest();
		$content = $request->getContent();
		$content = !empty($content) ? Json::decode($content, Json::TYPE_ARRAY) : array();
		$post = array_merge_recursive(
			$request->getPost()->toArray(),
			$content
		);
		$classifiedService = $this->getServiceLocator()->get('document.service.classified');

		$returnData = '';
		$action = strtolower($id);
		$classifiedService = $this->getServiceLocator()->get('document.service.classified');
		
		switch($action) {
			case 'bulk':
				$ids = $this->params()->fromQuery('ids', array());
				$ids = !is_array($ids) ? explode(",", $ids) : $ids;
				$success = 0;
				$error = 0;
				foreach($ids as $id) {
					try {
						$classifiedService->delete($id);		
						$success++;
					} catch(\Exception $e) {
						$error++;
					};
				}
						
				$returnData = array(
					'status' => 'success',
					'message' => 'Annunci eliminati con successo (' . $success . '/' . $error . ')'
				);
				break;
			default:
				try {
					$classifiedService->delete($id);
					$returnData = array(
						'status' => 'success',
						'message' => 'Annuncio eliminato con successo'
					);
				} catch(\Exception $e) {
					$this->getResponse()
					->setStatusCode(Response::STATUS_CODE_500);
					$returnData = array(
						'status' => 'danger',
						'message' => $e->getMessage()
					);
				}
				break;
		}

		return new JsonModel($returnData);
	}
562993
public function buildIds(string $id): array
    {
        $ids = [];
        $range = $this->buildRange($id);

        $from = $range->getFrom();
        $to = $range->getTo();
        $step = $range->getStep();
        for ($currentIndex = $from; $currentIndex <= $to; $currentIndex += $step) {
            $ids[
                str_replace(
                    $this->token,
                    $currentIndex,
                    $range->getName()
                )
            ] = $currentIndex;
        }

        return $ids;
    }
995921
public static function delete($id)
    {
        $result = (new \CUserTypeEntity())->Delete($id);

        if (!$result) {
            global $APPLICATION;
            throw new \Exception($APPLICATION->GetException());
        }

        Logger::log("Удален UF {$id}", Logger::COLOR_GREEN);
    }
1205122
public function deleteAction($id)
    {
        $request = $this->getRequest();
        $id = $request->get($this->admin->getIdParameter());
        $object = $this->admin->getObject($id);

        if (!$object) {
            throw $this->createNotFoundException(sprintf('unable to find the object with id: %s', $id));
        }

        $this->checkParentChildAssociation($request, $object);

        $this->admin->checkAccess('delete', $object);

        $preResponse = $this->preDelete($request, $object);
        if (null !== $preResponse) {
            return $preResponse;
        }

        if ('DELETE' === $this->getRestMethod()) {
            // check the csrf token
            $this->validateCsrfToken('sonata.delete');

            $objectName = $this->admin->toString($object);

            try {
                $this->admin->delete($object);

                if ($this->isXmlHttpRequest()) {
                    return $this->renderJson(['result' => 'ok'], 200, []);
                }

                $this->addFlash(
                    'sonata_flash_success',
                    $this->trans(
                        'flash_delete_success',
                        ['%name%' => $this->escapeHtml($objectName)],
                        'SonataAdminBundle'
                    )
                );
            } catch (ModelManagerException $e) {
                $this->handleModelManagerException($e);

                if ($this->isXmlHttpRequest()) {
                    return $this->renderJson(['result' => 'error'], 200, []);
                }

                $this->addFlash(
                    'sonata_flash_error',
                    $this->trans(
                        'flash_delete_error',
                        ['%name%' => $this->escapeHtml($objectName)],
                        'SonataAdminBundle'
                    )
                );
            }

            return $this->redirectTo($object);
        }

        // NEXT_MAJOR: Remove this line and use commented line below it instead
        $template = $this->admin->getTemplate('delete');
        // $template = $this->templateRegistry->getTemplate('delete');

        return $this->renderWithExtraParams($template, [
            'object' => $object,
            'action' => 'delete',
            'csrf_token' => $this->getCsrfToken('sonata.delete'),
        ], null);
    }
16561
public function moveToTrash($id)
    {
        $user = AppUser::find($id);

        if (!$user) {
            return response()->json(null, 404);
        }

        if (!$user->delete()) {
            return response()->json(null, 500); // @codeCoverageIgnore
        }

        return response()->json(null, 204);
    }
1067658
public function getReleaseAssets(string $id): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/:id/assets',
            $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id));
    }