public function afterDelete() { if ($this->type === self::TYPE_NODE) { $action = 'unfollowNode'; Node::updateCounterInfo($action, $this->target_id); } else { if ($this->type === self::TYPE_TOPIC) { $action = 'unfollowTopic'; Topic::updateCounterInfo($action, $this->target_id); } else { if ($this->type === self::TYPE_USER) { $action = 'unfollowUser'; UserInfo::updateCounterInfo('unfollowed', $this->target_id); } } } UserInfo::updateCounterInfo($action, Yii::$app->getUser()->getId()); return parent::afterDelete(); }