예제 #1
0
 /**
  * Applying actions!!!
  * @todo attach as event handler
  * @inheritdoc
  */
 public function afterSave($insert, $changedAttributes)
 {
     parent::afterSave($insert, $changedAttributes);
     if ($insert) {
         Yii::info(Html::a('Пользователь №' . $this->ContractorID, ['/user/admin/update', 'id' => $this->ContractorID]) . ' Транзакция: ID ' . $this->id . ': ' . $this->action->Name . ', сумма ' . $this->CashSum, 'info');
         if ($this->CashSum > 0) {
             //Применение акций!
             $discounts = ActionsRecord::getDiscounts();
             foreach ($discounts as $discount) {
                 $discount->apply($this);
             }
         }
     }
 }