本文整理匯總了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);
}