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


PHP Shop::hasDependency方法代码示例

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


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

示例1: delete

    /**
     * Remove a shop only if it has no dependencies, and remove its associations
     *
     * @return bool
     */
    public function delete()
    {
        if (Shop::hasDependency($this->id) || !($res = parent::delete())) {
            return false;
        }
        foreach (Shop::getAssoTables() as $table_name => $row) {
            $id = 'id_' . $row['type'];
            if ($row['type'] == 'fk_shop') {
                $id = 'id_shop';
            } else {
                $table_name .= '_' . $row['type'];
            }
            $res &= Db::getInstance()->execute('
				DELETE FROM `' . bqSQL(_DB_PREFIX_ . $table_name) . '`
				WHERE `' . bqSQL($id) . '`=' . (int) $this->id);
        }
        // removes stock available
        $res &= Db::getInstance()->delete('stock_available', 'id_shop = ' . (int) $this->id);
        // Remove urls
        $res &= Db::getInstance()->delete('shop_url', 'id_shop = ' . (int) $this->id);
        Shop::cacheShops(true);
        return $res;
    }
开发者ID:gks-stage,项目名称:prestashop,代码行数:28,代码来源:Shop.php

示例2: getList

 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     if (Shop::getContext() == Shop::CONTEXT_GROUP) {
         $this->_where .= ' AND a.id_shop_group = ' . (int) Shop::getContextShopGroupID();
     }
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
     $shop_delete_list = array();
     // don't allow to remove shop which have dependencies (customers / orders / ... )
     foreach ($this->_list as &$shop) {
         if (Shop::hasDependency($shop['id_shop'])) {
             $shop_delete_list[] = $shop['id_shop'];
         }
     }
     $this->context->smarty->assign('shops_having_dependencies', $shop_delete_list);
 }
开发者ID:gks-stage,项目名称:prestashop,代码行数:15,代码来源:AdminShopController.php


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