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


PHP ActiveRecord::afterDelete方法代码示例

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


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

示例1: afterDelete

 public function afterDelete()
 {
     if ($this->order) {
         $this->order->updateTotalPrice();
         $this->order->updateDeliveryPrice();
     }
     return parent::afterDelete();
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:8,代码来源:OrderProduct.php

示例2: afterDelete

 public function afterDelete()
 {
     $result = parent::afterDelete();
     if ($result) {
         Yii::app()->nfy->unsubscribe($this->id, null, true);
     }
     return $result;
 }
开发者ID:balitax,项目名称:plansys,代码行数:8,代码来源:User.php

示例3: afterDelete

 public function afterDelete()
 {
     if ($this->scenario != 'cascadaPartida') {
         foreach ($this->presupuestoPartida as $c) {
             $c->delete();
         }
     }
     return parent::afterDelete();
 }
开发者ID:EurekaSolutions,项目名称:sistemanc,代码行数:9,代码来源:PresupuestoPartidaProyecto.php

示例4: afterDelete

 public function afterDelete()
 {
     Yii::import('application.modules.cabinet.models.ShopItems');
     parent::afterDelete();
     // При удалении удаляю предметы из набора
     $items = ShopItems::model()->findAll('pack_id = :pack_id', array(':pack_id' => $this->id));
     foreach ($items as $item) {
         $item->delete();
     }
 }
开发者ID:mmorpg2015,项目名称:ghtweb5,代码行数:10,代码来源:ShopItemsPacks.php

示例5: afterDelete

 /**
  * Delete related data.
  */
 public function afterDelete()
 {
     // Delete related products
     $this->clearRelatedProducts();
     ShopRelatedProduct::model()->deleteAll('related_id=:id', array('id' => $this->id));
     // Delete categorization
     ShopProductCategoryRef::model()->deleteAllByAttributes(array('product' => $this->id));
     // Delete images
     $images = $this->images;
     if (!empty($images)) {
         foreach ($images as $image) {
             $image->delete();
         }
     }
     // Delete variants
     $variants = ShopProductVariant::model()->findAllByAttributes(array('product_id' => $this->id));
     foreach ($variants as $v) {
         $v->delete();
     }
     // Clear configurable attributes
     Yii::app()->db->createCommand()->delete('{{shop_product_configurable_attributes}}', 'product_id=:id', array(':id' => $this->id));
     // Delete configurations
     Yii::app()->db->createCommand()->delete('{{shop_product_configurations}}', 'product_id=:id', array(':id' => $this->id));
     Yii::app()->db->createCommand()->delete('{{shop_product_configurations}}', 'configurable_id=:id', array(':id' => $this->id));
     // Delete from wish lists if install module "wishlist"
     if (Yii::app()->hasModule('wishlist')) {
         Yii::import('mod.wishlist.models.*');
         $wishlistProduct = WishlistProducts::model()->findByAttributes(array('product_id' => $this->id));
         if ($wishlistProduct) {
             $wishlistProduct->delete();
         }
     }
     return parent::afterDelete();
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:37,代码来源:ShopProduct.php

示例6: afterDelete

 public function afterDelete()
 {
     //Remove all products with this category set as main.
     $products = ShopProductCategoryRef::model()->findAllByAttributes(array('category' => $this->id, 'is_main' => '1'));
     foreach ($products as $p) {
         $productModel = ShopProduct::model()->findByPk($p->product);
         if ($productModel) {
             $productModel->delete();
         }
     }
     // Remove all category-product relations
     ShopProductCategoryRef::model()->deleteAllByAttributes(array('category' => $this->id, 'is_main' => '0'));
     $this->clearRouteCache();
     return parent::afterDelete();
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:15,代码来源:ShopCategory.php

示例7: afterDelete

 public function afterDelete()
 {
     // Clear product relations
     ShopProduct::model()->updateAll(array('manufacturer_id' => new CDbExpression('NULL')), 'manufacturer_id = :id', array(':id' => $this->id));
     return parent::afterDelete();
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:6,代码来源:ShopManufacturer.php

示例8: afterDelete

 public function afterDelete()
 {
     // Delete options
     foreach ($this->options as $o) {
         $o->delete();
     }
     // Delete relations used in product type.
     ShopTypeAttribute::model()->deleteAllByAttributes(array('attribute_id' => $this->id));
     // Delete attributes assigned to products
     $conn = $this->getDbConnection();
     $command = $conn->createCommand("DELETE FROM `{{shop_product_attribute_eav}}` WHERE `attribute`='{$this->name}'");
     $command->execute();
     return parent::afterDelete();
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:14,代码来源:ShopAttribute.php

示例9: afterDelete

 public function afterDelete()
 {
     ServerConfig::model()->deleteByPk($this->id);
     UserServer::model()->deleteAllByAttributes(array('server_id' => $this->id));
     FtpUserServer::model()->deleteAllByAttributes(array('server_id' => $this->id));
     Command::model()->deleteAllByAttributes(array('server_id' => $this->id));
     Schedule::model()->deleteAllByAttributes(array('server_id' => $this->id));
     $plrs = Player::model()->findAllByAttributes(array('server_id' => $this->id));
     foreach ($plrs as $plr) {
         $plr->delete();
     }
     return parent::afterDelete();
 }
开发者ID:Jmainguy,项目名称:multicraft_install,代码行数:13,代码来源:Server.php

示例10: afterDelete

 public function afterDelete()
 {
     $this->setIds(array());
     parent::afterDelete();
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:5,代码来源:Wishlist.php

示例11: afterDelete

 public function afterDelete()
 {
     $path = Yii::getPathOfAlias(self::UPLOAD_PATH);
     if (file_exists($path . DS . $this->icon_file)) {
         unlink($path . DS . $this->icon_file);
     }
     parent::afterDelete();
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:8,代码来源:ContactsMarkers.php

示例12: afterDelete

 /**
  * After a PollVote is deleted.
  */
 public function afterDelete()
 {
     $this->choice->votes -= 1;
     $this->choice->save();
     parent::afterDelete();
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:9,代码来源:PollVote.php

示例13: afterDelete

	protected function afterDelete() 
	{
		if(parent::afterDelete()) {
			return true;
		} else {
			return false;
		}
	}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:8,代码来源:User.php

示例14: afterDelete

 public function afterDelete()
 {
     parent::afterDelete();
     foreach ($this->images as $image) {
         $image->delete();
     }
 }
开发者ID:Wiedzal,项目名称:narisuemvse,代码行数:7,代码来源:ShopProducts.php

示例15: afterDelete

 /**
  * Delete file, etc...
  */
 public function afterDelete()
 {
     // Delete file
     if (file_exists($this->filePath)) {
         unlink($this->filePath);
     }
     // If main image was deleted
     if ($this->is_main) {
         // Get first image and set it as main
         $model = ShopProductImage::model()->find();
         if ($model) {
             $model->is_main = 1;
             $model->save(false, false, false);
         }
     }
     return parent::afterDelete();
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:20,代码来源:ShopProductImage.php


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