From cbe52e57200a66522d88dfc5d5f46de8eb87ffb2 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 17 Jul 2016 18:47:06 -0400 Subject: File events refactoring --- app/EventBuilder/TaskFileEventBuilder.php | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 app/EventBuilder/TaskFileEventBuilder.php (limited to 'app/EventBuilder/TaskFileEventBuilder.php') diff --git a/app/EventBuilder/TaskFileEventBuilder.php b/app/EventBuilder/TaskFileEventBuilder.php new file mode 100644 index 00000000..7f1ce3b3 --- /dev/null +++ b/app/EventBuilder/TaskFileEventBuilder.php @@ -0,0 +1,50 @@ +fileId = $fileId; + return $this; + } + + /** + * Build event data + * + * @access public + * @return GenericEvent|null + */ + public function build() + { + $file = $this->taskFileModel->getById($this->fileId); + + if (empty($file)) { + $this->logger->debug(__METHOD__.': File not found'); + return null; + } + + return new TaskFileEvent(array( + 'file' => $file, + 'task' => $this->taskFinderModel->getDetails($file['task_id']), + )); + } +} -- cgit v1.2.3