本文整理汇总了PHP中BaseModel::afterDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseModel::afterDelete方法的具体用法?PHP BaseModel::afterDelete怎么用?PHP BaseModel::afterDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseModel
的用法示例。
在下文中一共展示了BaseModel::afterDelete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterDelete
public function afterDelete()
{
if ($this->order) {
$this->order->updateTotalPrice();
$this->order->updateDeliveryPrice();
}
return parent::afterDelete();
}
示例2: afterDelete
/**
* Delete file, etc...
*/
public function afterDelete()
{
// Delete file
if (file_exists($this->filePath)) {
unlink($this->filePath);
}
return parent::afterDelete();
}
示例3: afterDelete
/**
* Delete related data.
*/
public function afterDelete()
{
// Delete related products
$this->clearRelatedProducts();
StoreRelatedProduct::model()->deleteAll('related_id=:id', array('id' => $this->id));
// Delete categorization
StoreProductCategoryRef::model()->deleteAllByAttributes(array('product' => $this->id));
// Delete images
$images = $this->images;
if (!empty($images)) {
foreach ($images as $image) {
$image->delete();
}
}
// Delete variants
$variants = StoreProductVariant::model()->findAllByAttributes(array('product_id' => $this->id));
foreach ($variants as $v) {
$v->delete();
}
// Clear configurable attributes
Yii::app()->db->createCommand()->delete('StoreProductConfigurableAttributes', 'product_id=:id', array(':id' => $this->id));
// Delete configurations
Yii::app()->db->createCommand()->delete('StoreProductConfigurations', 'product_id=:id', array(':id' => $this->id));
Yii::app()->db->createCommand()->delete('StoreProductConfigurations', 'configurable_id=:id', array(':id' => $this->id));
// Delete from wish lists
Yii::import('application.modules.store.models.wishlist.StoreWishlistProducts');
$wishlistProduct = StoreWishlistProducts::model()->findByAttributes(array('product_id' => $this->id));
if ($wishlistProduct) {
$wishlistProduct->delete();
}
return parent::afterDelete();
}
示例4: afterDelete
/**
* After delete event
*/
public function afterDelete()
{
$profile = $this->profile;
if ($profile) {
$profile->delete();
}
parent::afterDelete();
}
示例5: afterDelete
/**
* Delete related data.
*/
public function afterDelete()
{
// Delete images
$images = $this->images;
if(!empty($images))
{
foreach ($images as $image)
$image->delete();
}
return parent::afterDelete();
}
示例6: afterDelete
/**
* After delete module
*/
public function afterDelete()
{
self::loadModuleClass($this->name)->afterRemove();
self::deleteCaches();
self::buildEventsFile();
return parent::afterDelete();
}
示例7: afterDelete
public function afterDelete()
{
//Remove all products with this category set as main.
$products = StoreProductCategoryRef::model()->findAllByAttributes(array('category' => $this->id, 'is_main' => '1'));
foreach ($products as $p) {
$productModel = StoreProduct::model()->findByPk($p->product);
if ($productModel) {
$productModel->delete();
}
}
// Remove all category-product relations
StoreProductCategoryRef::model()->deleteAllByAttributes(array('category' => $this->id, 'is_main' => '0'));
$this->clearRouteCache();
return parent::afterDelete();
}
示例8: afterDelete
public function afterDelete()
{
$this->setIds(array());
parent::afterDelete();
}
示例9: afterDelete
/**
* @return bool
*/
public function afterDelete()
{
foreach ($this->products as $ordered_product) {
$ordered_product->delete();
}
return parent::afterDelete();
}
示例10: afterDelete
/**
* Delete related data.
*/
public function afterDelete()
{
return parent::afterDelete();
}
示例11: afterDelete
public function afterDelete()
{
// Clear type attribute relations
StoreTypeAttribute::model()->deleteAllByAttributes(array('type_id' => $this->id));
return parent::afterDelete();
}
示例12: afterDelete
public function afterDelete()
{
// Clear product relations
StoreProduct::model()->updateAll(array('manufacturer_id' => new CDbExpression('NULL')), 'manufacturer_id = :id', array(':id' => $this->id));
return parent::afterDelete();
}
示例13: afterDelete
public function afterDelete()
{
// Delete options
foreach($this->options as $o)
$o->delete();
// Delete relations used in product type.
EavTypeAttribute::model()->deleteAllByAttributes(array('attribute_id'=>$this->id));
// Delete attributes assigned to products
$conn = $this->getDbConnection();
$command = $conn->createCommand("DELETE FROM eav_variants WHERE attribute_name='{$this->name}'");
$command->execute();
return parent::afterDelete();
}
示例14: afterDelete
protected function afterDelete()
{
parent::afterDelete();
vPorderDetail::model()->deleteAll(array('condition' => 'parent_id= :id', 'params' => array(':id' => $this->id)));
}
示例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 = PageImage::model()->find();
if ($model) {
$model->is_main = 1;
$model->save(false);
}
}
return parent::afterDelete();
}