当前位置: 首页>>代码示例>>PHP>>正文


PHP CIBlockProperty::DropColumnSQL方法代码示例

本文整理汇总了PHP中CIBlockProperty::DropColumnSQL方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockProperty::DropColumnSQL方法的具体用法?PHP CIBlockProperty::DropColumnSQL怎么用?PHP CIBlockProperty::DropColumnSQL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CIBlockProperty的用法示例。


在下文中一共展示了CIBlockProperty::DropColumnSQL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Delete

 /**
  * <p>Метод удаляет свойство и все его значения. Метод статический.</p>
  *
  *
  * @param int $ID  Код свойства.
  *
  * @return bool <p>В случае успешного удаления возвращается true, иначе - false. </p> <br><br>
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblockproperty/delete.php
  * @author Bitrix
  */
 public static function Delete($ID)
 {
     /** @var CMain $APPLICATION */
     global $DB, $APPLICATION;
     $ID = IntVal($ID);
     $APPLICATION->ResetException();
     foreach (GetModuleEvents("iblock", "OnBeforeIBlockPropertyDelete", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
             $err = GetMessage("MAIN_BEFORE_DEL_ERR") . ' ' . $arEvent['TO_NAME'];
             if ($ex = $APPLICATION->GetException()) {
                 $err .= ': ' . $ex->GetString();
             }
             $APPLICATION->throwException($err);
             return false;
         }
     }
     foreach (GetModuleEvents("iblock", "OnIBlockPropertyDelete", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID));
     }
     if (!CIBlockPropertyEnum::DeleteByPropertyID($ID, true)) {
         return false;
     }
     CIBlockSectionPropertyLink::DeleteByProperty($ID);
     $rsProperty = CIBlockProperty::GetByID($ID);
     $arProperty = $rsProperty->Fetch();
     if ($arProperty["VERSION"] == 2) {
         if ($arProperty["PROPERTY_TYPE"] == "F") {
             if ($arProperty["MULTIPLE"] == "Y") {
                 $strSql = "\n\t\t\t\t\t\tSELECT\tVALUE\n\t\t\t\t\t\tFROM\tb_iblock_element_prop_m" . $arProperty["IBLOCK_ID"] . "\n\t\t\t\t\t\tWHERE\tIBLOCK_PROPERTY_ID=" . $ID . "\n\t\t\t\t\t";
             } else {
                 $strSql = "\n\t\t\t\t\t\tSELECT\tPROPERTY_" . $ID . " VALUE\n\t\t\t\t\t\tFROM\tb_iblock_element_prop_s" . $arProperty["IBLOCK_ID"] . "\n\t\t\t\t\t\tWHERE\tPROPERTY_" . $ID . " is not null\n\t\t\t\t\t";
             }
             $res = $DB->Query($strSql);
             while ($arr = $res->Fetch()) {
                 CFile::Delete($arr["VALUE"]);
             }
         }
         if (!$DB->Query("DELETE FROM b_iblock_section_element WHERE ADDITIONAL_PROPERTY_ID=" . $ID, true)) {
             return false;
         }
         $strSql = "\n\t\t\t\tDELETE\n\t\t\t\tFROM b_iblock_element_prop_m" . $arProperty["IBLOCK_ID"] . "\n\t\t\t\tWHERE IBLOCK_PROPERTY_ID=" . $ID . "\n\t\t\t";
         if (!$DB->Query($strSql)) {
             return false;
         }
         $arSql = CIBlockProperty::DropColumnSQL("b_iblock_element_prop_s" . $arProperty["IBLOCK_ID"], array("PROPERTY_" . $ID, "DESCRIPTION_" . $ID));
         foreach ($arSql as $strSql) {
             if (!$DB->DDL($strSql)) {
                 return false;
             }
         }
     } else {
         $res = $DB->Query("SELECT EP.VALUE FROM b_iblock_property P, b_iblock_element_property EP WHERE P.ID=" . $ID . " AND P.ID=EP.IBLOCK_PROPERTY_ID AND P.PROPERTY_TYPE='F'");
         while ($arr = $res->Fetch()) {
             CFile::Delete($arr["VALUE"]);
         }
         if (!$DB->Query("DELETE FROM b_iblock_section_element WHERE ADDITIONAL_PROPERTY_ID=" . $ID, true)) {
             return false;
         }
         if (!$DB->Query("DELETE FROM b_iblock_element_property WHERE IBLOCK_PROPERTY_ID=" . $ID, true)) {
             return false;
         }
     }
     $seq = new CIBlockSequence($arProperty["IBLOCK_ID"], $ID);
     $seq->Drop();
     return $DB->Query("DELETE FROM b_iblock_property WHERE ID=" . $ID, true);
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:78,代码来源:iblockproperty.php


注:本文中的CIBlockProperty::DropColumnSQL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。