示例#1
0
 public function afterUninstall()
 {
     Yii::app()->settings->clear($this->id);
     //Yii::app()->unintallComponent('cart');
     $db = Yii::app()->db;
     $tablesArray = array(Order::model()->tableName(), OrderHistory::model()->tableName(), OrderProduct::model()->tableName(), OrderStatus::model()->tableName(), OrderProductHistroy::model()->tableName(), ShopPaymentMethod::model()->tableName(), ShopPaymentMethodTranslate::model()->tableName(), ShopDeliveryMethod::model()->tableName(), ShopDeliveryMethodTranslate::model()->tableName(), ShopDeliveryPayment::model()->tableName(), ProductNotifications::model()->tableName());
     foreach ($tablesArray as $table) {
         $db->createCommand()->dropTable($table);
     }
     return parent::afterInstall();
 }
 /**
  * After save event
  */
 public function afterSave()
 {
     // Clear payment relations
     ShopDeliveryPayment::model()->deleteAllByAttributes(array('delivery_id' => $this->id));
     foreach ($this->payment_methods as $pid) {
         $model = new ShopDeliveryPayment();
         $model->delivery_id = $this->id;
         $model->payment_id = $pid;
         $model->save(false);
     }
     return parent::afterSave();
 }