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


PHP ObjectModel::delete方法代码示例

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


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

示例1: delete

    public function delete()
    {
        $res = true;
        $images = $this->image;
        foreach ($images as $image) {
            if (preg_match('/sample/', $image) === 0) {
                if ($image) {
                    if (file_exists(dirname(__FILE__) . '/images/' . $image)) {
                        $res &= @unlink(dirname(__FILE__) . '/images/' . $image);
                    }
                    if (file_exists(dirname(__FILE__) . '/images/thumb_' . $image)) {
                        $res &= @unlink(dirname(__FILE__) . '/images/thumb_' . $image);
                    }
                    if (file_exists(dirname(__FILE__) . '/images/resize_' . $image)) {
                        $res &= @unlink(dirname(__FILE__) . '/images/resize_' . $image);
                    }
                }
            }
        }
        $res &= $this->reOrderPositions();
        $res &= Db::getInstance()->execute('
			DELETE FROM `' . _DB_PREFIX_ . 'homesliderpro`
			WHERE `id_homeslider_slides` = ' . (int) $this->id);
        $res &= parent::delete();
        return $res;
    }
开发者ID:ac3gam3r,项目名称:Maxokraft,代码行数:26,代码来源:HomeSlidePro.php

示例2: delete

 public function delete()
 {
     if (parent::delete()) {
         return $this->cleanPositions($this->id_cms_category);
     }
     return false;
 }
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:7,代码来源:CMS.php

示例3: delete

 public function delete()
 {
     if (($result = Db::getInstance()->ExecuteS('SELECT `id_product_attribute` FROM `' . _DB_PREFIX_ . 'product_attribute_combination` WHERE `' . $this->identifier . '` = ' . (int) $this->id)) != false) {
         return false;
     }
     $combinationIds = array();
     if (Db::getInstance()->numRows()) {
         foreach ($result as $row) {
             $combinationIds[] = (int) $row['id_product_attribute'];
         }
         if (Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'product_attribute_combination` WHERE `' . $this->identifier . '` = ' . (int) $this->id) === false) {
             return false;
         }
         if (Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'product_attribute` WHERE `id_product_attribute` IN (' . implode(', ', $combinationIds) . ')') === false) {
             return false;
         }
     }
     if (!$this->deleteImage()) {
         return false;
     }
     $return = parent::delete();
     if ($return) {
         Module::hookExec('afterDeleteAttribute', array('id_attribute' => $this->id));
     }
     return $return;
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:26,代码来源:Attribute.php

示例4: delete

 public function delete()
 {
     /* Select children in order to find linked combinations */
     $attributeIds = Db::getInstance()->ExecuteS('SELECT `id_attribute` FROM `' . _DB_PREFIX_ . 'attribute` WHERE `id_attribute_group` = ' . intval($this->id));
     if ($attributeIds === false) {
         return false;
     }
     /* Removing attributes to the found combinations */
     $toRemove = array();
     foreach ($attributeIds as $attribute) {
         $toRemove[] = intval($attribute['id_attribute']);
     }
     if (!empty($toRemove) and Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'product_attribute_combination` WHERE `id_attribute` IN (' . implode(', ', $toRemove) . ')') === false) {
         return false;
     }
     /* Remove combinations if they do not possess attributes anymore */
     if (!self::cleanDeadCombinations()) {
         return false;
     }
     /* Also delete related attributes */
     if (Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'attribute_lang` WHERE `id_attribute` IN (SELECT id_attribute FROM `' . _DB_PREFIX_ . 'attribute` WHERE `id_attribute_group` = ' . intval($this->id) . ')') === false or Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'attribute` WHERE `id_attribute_group` = ' . intval($this->id)) === false) {
         return false;
     }
     return parent::delete();
 }
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:25,代码来源:AttributeGroup.php

示例5: delete

 public function delete()
 {
     if (parent::delete()) {
         return Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'access` WHERE `id_profile` = ' . intval($this->id));
     }
     return false;
 }
开发者ID:vincent,项目名称:theinvertebrates,代码行数:7,代码来源:Profile.php

示例6: delete

 public function delete()
 {
     if (parent::delete()) {
         return Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'access` WHERE `id_profile` = ' . (int) $this->id) && Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'module_access` WHERE `id_profile` = ' . (int) $this->id);
     }
     return false;
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:7,代码来源:Profile.php

示例7: delete

 public function delete()
 {
     if (!Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'order:shipment` WHERE `id_order_shipment` = ' . intval($this->id))) {
         return false;
     }
     return parent::delete();
 }
开发者ID:redb,项目名称:prestashop,代码行数:7,代码来源:OrderShipment.php

示例8: delete

 public function delete()
 {
     if (!parent::delete()) {
         return false;
     }
     return Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'cart_rule_country WHERE id_country = ' . (int) $this->id);
 }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:7,代码来源:Country.php

示例9: delete

 public function delete()
 {
     if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL) {
         $result = Db::getInstance()->executeS('SELECT id_product_attribute FROM ' . _DB_PREFIX_ . 'product_attribute_combination WHERE id_attribute = ' . (int) $this->id);
         $products = array();
         foreach ($result as $row) {
             $combination = new Combination($row['id_product_attribute']);
             $new_request = Db::getInstance()->executeS('SELECT id_product, default_on FROM ' . _DB_PREFIX_ . 'product_attribute WHERE id_product_attribute = ' . (int) $row['id_product_attribute']);
             foreach ($new_request as $value) {
                 if ($value['default_on'] == 1) {
                     $products[] = $value['id_product'];
                 }
             }
             $combination->delete();
         }
         foreach ($products as $product) {
             $result = Db::getInstance()->executeS('SELECT id_product_attribute FROM ' . _DB_PREFIX_ . 'product_attribute WHERE id_product = ' . (int) $product . ' LIMIT 1');
             foreach ($result as $row) {
                 if (Validate::isLoadedObject($product = new Product((int) $product))) {
                     $product->deleteDefaultAttributes();
                     $product->setDefaultAttribute($row['id_product_attribute']);
                 }
             }
         }
         // Delete associated restrictions on cart rules
         CartRule::cleanProductRuleIntegrity('attributes', $this->id);
         /* Reinitializing position */
         $this->cleanPositions((int) $this->id_attribute_group);
     }
     $return = parent::delete();
     if ($return) {
         Hook::exec('actionAttributeDelete', array('id_attribute' => $this->id));
     }
     return $return;
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:35,代码来源:Attribute.php

示例10: delete

 public function delete()
 {
     if (!empty($this->file_name)) {
         @unlink(_PS_UPLOAD_DIR_ . $this->file_name);
     }
     return parent::delete();
 }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:7,代码来源:CustomerMessage.php

示例11: delete

 public function delete()
 {
     $id = $this->id;
     parent::delete();
     // remove associated zip codes & tax rule
     return County::deleteZipCodeByIdCounty($id) and TaxRule::deleteTaxRuleByIdCounty($id);
 }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:7,代码来源:County.php

示例12: delete

 /**
  * Delete object
  *
  * @param bool $deleteFile if true delete the file on disk
  * @return bool success
  */
 public function delete($deleteFile = false)
 {
     if ($deleteFile) {
         $this->deleteFile();
     }
     return parent::delete();
 }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:13,代码来源:ProductDownload.php

示例13: delete

 public function delete()
 {
     if ((int) $this->id === 0) {
         return false;
     }
     return SimpleBlogCategory::deleteCover($this) && parent::delete() && $this->cleanPositions($this->id_parent);
 }
开发者ID:evgrishin,项目名称:se1614,代码行数:7,代码来源:SimpleBlogCategory.php

示例14: delete

    public function delete()
    {
        if (!parent::delete()) {
            return false;
        }
        if ($this->hasMultishopEntries()) {
            return true;
        }
        if (!$this->deleteProductAttributeImage() || !$this->deleteImage()) {
            return false;
        }
        // update positions
        $result = Db::getInstance()->executeS('
			SELECT *
			FROM `' . _DB_PREFIX_ . 'image`
			WHERE `id_product` = ' . (int) $this->id_product . '
			ORDER BY `position`
		');
        $i = 1;
        if ($result) {
            foreach ($result as $row) {
                $row['position'] = $i++;
                Db::getInstance()->update($this->def['table'], $row, '`id_image` = ' . (int) $row['id_image'], 1);
            }
        }
        return true;
    }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:27,代码来源:Image.php

示例15: delete

 public function delete()
 {
     if ((int) $this->id === 0) {
         return false;
     }
     return SimpleBlogPost::deleteCover($this) && SimpleBlogPost::deleteFeatured($this) && parent::delete();
 }
开发者ID:OaSiis,项目名称:LDDP,代码行数:7,代码来源:SimpleBlogPost.php


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