From ec0ecc5b0387924f061865f4ec12dbfc5b7018fe Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 17 Jul 2016 17:15:14 -0400 Subject: Added event for removed comments with some refactoring --- app/EventBuilder/CommentEventBuilder.php | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 app/EventBuilder/CommentEventBuilder.php (limited to 'app/EventBuilder/CommentEventBuilder.php') diff --git a/app/EventBuilder/CommentEventBuilder.php b/app/EventBuilder/CommentEventBuilder.php new file mode 100644 index 00000000..7b4060e4 --- /dev/null +++ b/app/EventBuilder/CommentEventBuilder.php @@ -0,0 +1,48 @@ +commentId = $commentId; + return $this; + } + + /** + * Build event data + * + * @access public + * @return CommentEvent|null + */ + public function build() + { + $comment = $this->commentModel->getById($this->commentId); + + if (empty($comment)) { + return null; + } + + return new CommentEvent(array( + 'comment' => $comment, + 'task' => $this->taskFinderModel->getDetails($comment['task_id']), + )); + } +} -- cgit v1.2.3