本文整理汇总了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;
}
示例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);
}