本文整理汇总了PHP中Manufacturer::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Manufacturer::delete方法的具体用法?PHP Manufacturer::delete怎么用?PHP Manufacturer::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manufacturer
的用法示例。
在下文中一共展示了Manufacturer::delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: truncateTables
private function truncateTables($case)
{
switch ((int) $case) {
case $this->entities[$this->l('Categories')]:
$categories = Db::getInstance()->ExecuteS('SELECT `id_category` FROM `' . _DB_PREFIX_ . 'category` WHERE id_category != 1');
foreach ($categories as $category) {
$c = new Category((int) $category['id_category']);
$c->delete();
}
break;
case $this->entities[$this->l('Products')]:
$products = Db::getInstance()->ExecuteS('SELECT `id_product` FROM `' . _DB_PREFIX_ . 'product`');
foreach ($products as $product) {
$p = new Product((int) $product['id_product']);
$p->delete(true);
}
break;
case $this->entities[$this->l('Customers')]:
$customers = Db::getInstance()->ExecuteS('SELECT `id_customer` FROM `' . _DB_PREFIX_ . 'customer`');
foreach ($customers as $customer) {
$c = new Customer((int) $customer['id_customer']);
$c->delete();
}
break;
case $this->entities[$this->l('Addresses')]:
$addresses = Db::getInstance()->ExecuteS('SELECT `id_address` FROM `' . _DB_PREFIX_ . 'address`');
foreach ($addresses as $address) {
$a = new Address((int) $address['id_address']);
$a->delete();
}
break;
case $this->entities[$this->l('Combinations')]:
$products = Db::getInstance()->ExecuteS('SELECT `id_product` FROM `' . _DB_PREFIX_ . 'product`');
foreach ($products as $product) {
$p = new Product((int) $product['id_product']);
$p->deleteProductAttributes();
}
break;
case $this->entities[$this->l('Manufacturers')]:
$manufacturers = Db::getInstance()->ExecuteS('SELECT `id_manufacturer` FROM `' . _DB_PREFIX_ . 'manufacturer`');
foreach ($manufacturers as $manufacturer) {
$m = new Manufacturer((int) $manufacturer['id_manufacturer']);
$m->delete();
}
break;
case $this->entities[$this->l('Suppliers')]:
$suppliers = Db::getInstance()->ExecuteS('SELECT `id_supplier` FROM `' . _DB_PREFIX_ . 'supplier`');
foreach ($suppliers as $supplier) {
$m = new Supplier((int) $supplier['id_supplier']);
$m->delete();
}
break;
}
Image::clearTmpDir();
return true;
}
示例2: update_manufacturers
/**
* Updates the Manufacturers in the database
*
* Stores or deletes records depending on the contents of the
* current request
* @return boolean True on success, null on noop, false otherwise
*/
static function update_manufacturers()
{
global $_ARRAYLANG;
// Delete any single manufacturer, if requested to
if (!empty($_GET['delete'])) {
$manufacturer_id = intval($_GET['delete']);
return Manufacturer::delete($manufacturer_id);
}
// Multiaction: Only deleting implemented
if (!empty($_POST['multi_action']) && !empty($_POST['selected_manufacturer_id']) && is_array($_POST['selected_manufacturer_id'])) {
switch ($_POST['multi_action']) {
case 'delete':
// Delete multiple selected manufacturers
return Manufacturer::delete($_POST['selected_manufacturer_id']);
}
}
if (!isset($_POST['bstore'])) {
return null;
}
if (empty($_POST['name'])) {
return \Message::error($_ARRAYLANG['TXT_SHOP_MANUFACTURER_ERROR_EMPTY_NAME']);
}
$manufacturer_id = empty($_POST['id']) ? null : intval($_POST['id']);
$name = empty($_POST['name']) ? '' : contrexx_input2raw($_POST['name']);
$url = empty($_REQUEST['url']) ? '' : contrexx_input2raw($_REQUEST['url']);
//DBG::log("ShopManager::update_manufacturers(): Storing Manufacturer: $name, $url, $manufacturer_id");
$result = Manufacturer::store($name, $url, $manufacturer_id);
if ($result) {
// Do not set up the same Manufacturer for editing again after
// storing it successfully
$_REQUEST['id'] = $_POST['name'] = $_POST['url'] = null;
Manufacturer::flush();
}
return $result;
}
示例3: catch
} catch (fNotFoundException $e) {
fMessaging::create('error', fURL::get(), 'The manufacturer requested, ID ' . $id . ', could not be found.');
fURL::redirect(fURL::get());
} catch (fExpectedException $e) {
fMessaging::create('error', fURL::get(), $e->getMessage());
}
include 'views/manufacturers/addedit.php';
}
/**
* Delete a manufacturer
*/
if ($action == 'delete') {
// Get ID
$id = fRequest::get('id', 'integer');
try {
$m = new Manufacturer($id);
if (fRequest::isPost()) {
$m->delete();
fMessaging::create('success', fURL::get(), 'The manufacturer ' . $m->getName() . ' was successfully deleted.');
fURL::redirect(fURL::get());
}
} catch (fNotFoundException $e) {
fMessaging::create('error', fURL::get(), 'The manufacturer requested, ID ' . $id . ', could not be found.');
fURL::redirect($manage_url);
} catch (fExpectedException $e) {
fMessaging::create('error', fURL::get(), $e->getMessage());
} catch (fSQLException $e) {
fMessaging::create('error', fURL::get(), 'Database error: ' . $e->getMessage());
}
include 'views/manufacturers/delete.php';
}
示例4: delete
/**
* @param integer $id
* @return string
* @throws ManufacturerIDMissingException
*/
public static function delete($id)
{
global $user;
if (is_numeric($id) and $user->is_admin() == true) {
$manufacturer = new Manufacturer($id);
if ($manufacturer->delete() == true) {
echo 1;
} else {
echo 0;
}
} else {
throw new ManufacturerIDMissingException();
}
}