本文整理汇总了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();
}
示例2: afterDelete
public function afterDelete()
{
$result = parent::afterDelete();
if ($result) {
Yii::app()->nfy->unsubscribe($this->id, null, true);
}
return $result;
}
示例3: afterDelete
public function afterDelete()
{
if ($this->scenario != 'cascadaPartida') {
foreach ($this->presupuestoPartida as $c) {
$c->delete();
}
}
return parent::afterDelete();
}
示例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();
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例10: afterDelete
public function afterDelete()
{
$this->setIds(array());
parent::afterDelete();
}
示例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();
}
示例12: afterDelete
/**
* After a PollVote is deleted.
*/
public function afterDelete()
{
$this->choice->votes -= 1;
$this->choice->save();
parent::afterDelete();
}
示例13: afterDelete
protected function afterDelete()
{
if(parent::afterDelete()) {
return true;
} else {
return false;
}
}
示例14: afterDelete
public function afterDelete()
{
parent::afterDelete();
foreach ($this->images as $image) {
$image->delete();
}
}
示例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();
}