content, 0, 32); $article = $this->findArticle($comment->item_id); $notification = new NotificationModel(); $notification->sender_id = $comment->owner_id; $notification->receiver_id = $article->owner_id; $notification->event_id = $comment->id; $notification->event_type = NotificationModel::TYPE_ARTICLE_COMMENTED; $notification->event_info = [ 'article' => ['id' => $article->id, 'title' => $article->title], 'comment' => ['id' => $comment->id, 'content' => $commentContent], ]; $notification->create(); } protected function findArticle($id) { $articleRepo = new ArticleRepo(); return $articleRepo->findById($id); } protected function findUser($id) { $userRepo = new UserRepo(); return $userRepo->findById($id); } }