Beispiel #1
0
 /**
  * @inheritdoc
  */
 public function afterSave($insert, $changedAttributes)
 {
     if ($insert and $this->active == true) {
         $this->recalc();
     }
     if (!$insert and isset($changedAttributes['active'])) {
         $this->recalc();
     }
     parent::afterSave($insert, $changedAttributes);
 }
Beispiel #2
0
 /**
  * @inheritdoc
  * сохраняем шаблон письма
  */
 public function afterSave($insert, $changedAttributes)
 {
     parent::afterSave($insert, $changedAttributes);
     Yii::$app->getModule('shop')->orderLetters->saveStatusTpl($this);
 }
Beispiel #3
0
 /**
  * @inheritdoc
  * Сохраняет добавленные к заказу товары. Отправляет уведомление пользователю, если статус заказа изменился.
  */
 public function afterSave($insert, $changedAttributes)
 {
     foreach ($this->_goods as $k => $good) {
         $this->link("goods", $good);
     }
     $this->_goods = [];
     // Отправляем уведомление клиенту при изменении статуса заказа
     if (in_array("status_id", array_keys($changedAttributes)) and $changedAttributes["status_id"] != $this->status_id) {
         Yii::$app->getModule('shop')->clientNotifier->notify($this);
     }
     return parent::afterSave($insert, $changedAttributes);
 }
Beispiel #4
0
 /**
  * @inheritdoc
  */
 public function afterSave($insert, $changeAttributes)
 {
     parent::afterSave($insert, $changeAttributes);
     $auth = Yii::$app->authManager;
     $auth->revokeAll($this->getId());
     $role = $auth->getRole($this->role);
     $auth->assign($role, $this->getId());
 }