request->getPost(); $user = $this->getLoginUser(); $article = new ArticleModel(); $data = $this->handlePostData($post); $data['owner_id'] = $user->id; $article->create($data); if (isset($post['xm_tag_ids'])) { $this->saveTags($article, $post['xm_tag_ids']); } $this->incrUserArticleCount($user); $this->eventsManager->fire('Article:afterCreate', $this, $article); return $article; } protected function incrUserArticleCount(UserModel $user) { $user->article_count += 1; $user->update(); } }