本文整理汇总了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;
}
示例2: delete
public function delete()
{
if (parent::delete()) {
return $this->cleanPositions($this->id_cms_category);
}
return false;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
示例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;
}
示例10: delete
public function delete()
{
if (!empty($this->file_name)) {
@unlink(_PS_UPLOAD_DIR_ . $this->file_name);
}
return parent::delete();
}
示例11: delete
public function delete()
{
$id = $this->id;
parent::delete();
// remove associated zip codes & tax rule
return County::deleteZipCodeByIdCounty($id) and TaxRule::deleteTaxRuleByIdCounty($id);
}
示例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();
}
示例13: delete
public function delete()
{
if ((int) $this->id === 0) {
return false;
}
return SimpleBlogCategory::deleteCover($this) && parent::delete() && $this->cleanPositions($this->id_parent);
}
示例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;
}
示例15: delete
public function delete()
{
if ((int) $this->id === 0) {
return false;
}
return SimpleBlogPost::deleteCover($this) && SimpleBlogPost::deleteFeatured($this) && parent::delete();
}