本文整理匯總了PHP中Bitrix\Highloadblock\HighloadBlockTable::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP HighloadBlockTable::delete方法的具體用法?PHP HighloadBlockTable::delete怎麽用?PHP HighloadBlockTable::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Bitrix\Highloadblock\HighloadBlockTable
的用法示例。
在下文中一共展示了HighloadBlockTable::delete方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: UnInstallDB
function UnInstallDB($arParams = array())
{
global $DB, $DBType, $APPLICATION;
$this->errors = false;
if (!array_key_exists("save_tables", $arParams) || $arParams["save_tables"] != "Y") {
// remove user data
CModule::IncludeModule("highloadblock");
$result = \Bitrix\Highloadblock\HighloadBlockTable::getList();
while ($hldata = $result->fetch()) {
\Bitrix\Highloadblock\HighloadBlockTable::delete($hldata['ID']);
}
// remove hl system data
$this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/highloadblock/install/db/" . strtolower($DB->type) . "/uninstall.sql");
}
UnRegisterModule("highloadblock");
UnRegisterModuleDependences("main", "OnBeforeUserTypeAdd", "highloadblock", '\\Bitrix\\Highloadblock\\HighloadBlockTable', "OnBeforeUserTypeAdd");
UnRegisterModuleDependences("main", "OnAfterUserTypeAdd", "highloadblock", '\\Bitrix\\Highloadblock\\HighloadBlockTable', "onAfterUserTypeAdd");
UnRegisterModuleDependences("main", "OnBeforeUserTypeDelete", "highloadblock", '\\Bitrix\\Highloadblock\\HighloadBlockTable', "OnBeforeUserTypeDelete");
UnRegisterModuleDependences('main', 'OnUserTypeBuildList', 'highloadblock', 'CUserTypeHlblock', 'GetUserTypeDescription');
UnRegisterModuleDependences('iblock', 'OnIBlockPropertyBuildList', 'highloadblock', 'CIBlockPropertyDirectory', 'GetUserTypeDescription');
if ($this->errors !== false) {
$APPLICATION->ThrowException(implode("<br>", $this->errors));
return false;
}
return true;
}
示例2: deleteHlblock
public function deleteHlblock($hlblockId)
{
$result = HL\HighloadBlockTable::delete($hlblockId);
if ($result->isSuccess()) {
return true;
}
$this->throwException(__METHOD__, implode(', ', $result->getErrors()));
}
示例3: array
if ($is_create_form) {
// default values for create form
$hlblock = array_fill_keys(array('ID', 'NAME', 'TABLE_NAME'), '');
// page title
$APPLICATION->SetTitle(GetMessage('HLBLOCK_ADMIN_ENTITY_EDIT_PAGE_TITLE_NEW'));
} else {
$APPLICATION->SetTitle(GetMessage('HLBLOCK_ADMIN_ENTITY_EDIT_PAGE_TITLE_EDIT', array('#NAME#' => $hlblock['NAME'])));
$entity = HL\HighloadBlockTable::compileEntity($hlblock);
$entity_data_class = $entity->getDataClass();
$entity_table_name = $hlblock['TABLE_NAME'];
$hlblock['ROWS_COUNT'] = $entity_data_class::getCount();
}
$isEditMode = true;
// delete action
if ($is_update_form && isset($_REQUEST['action']) && $_REQUEST['action'] === 'delete' && check_bitrix_sessid()) {
HL\HighloadBlockTable::delete($hlblock['ID']);
LocalRedirect("highloadblock_index.php?lang=" . LANGUAGE_ID);
}
// save action
if ((strlen($save) > 0 || strlen($apply) > 0) && $REQUEST_METHOD == "POST" && check_bitrix_sessid()) {
$data = array('NAME' => trim($_REQUEST['NAME']), 'TABLE_NAME' => trim($_REQUEST['TABLE_NAME']));
if ($is_update_form) {
$ID = intval($_REQUEST['ID']);
$result = HL\HighloadBlockTable::update($ID, $data);
} else {
// create
$result = HL\HighloadBlockTable::add($data);
$ID = $result->getId();
}
if ($result->isSuccess()) {
if (strlen($save) > 0) {
示例4: Delete
/**
* Delete
* @param $entityName
* @return bool
* @throws \Exception
*/
public static function Delete($entityName)
{
$userType = new \CUserTypeEntity();
if (!strlen($entityName)) {
throw new BimException('Incorrect entityName param value');
}
$filter = array('NAME' => $entityName);
$hlBlockDbRes = HL\HighloadBlockTable::getList(array("filter" => $filter));
if (!$hlBlockDbRes->getSelectedRowsCount()) {
throw new BimException('Not found highloadBlock with entityName = ' . $entityName);
}
$hlBlockRow = $hlBlockDbRes->fetch();
$entity = HL\HighloadBlockTable::compileEntity($hlBlockRow);
$entityDataClass = $entity->getDataClass();
$obList = $entityDataClass::getList();
if ($obList->getSelectedRowsCount() > 0) {
throw new BimException('Unable to remove a highloadBlock[' . $entityName . '], because it has elements');
}
# delete all Fields
$obHl = $userType->GetList(array(), array("ENTITY_ID" => "HLBLOCK_" . $hlBlockRow['ID']));
while ($arHl = $obHl->Fetch()) {
$obUF = new \CUserTypeEntity();
$obUF->Delete($arHl['ID']);
}
$delResult = HL\HighloadBlockTable::delete($hlBlockRow['ID']);
if (!$delResult->isSuccess()) {
throw new BimException(implode(", ", $delResult->getErrorMessages()));
}
return true;
}