Last active
April 26, 2017 22:18
-
-
Save pmjones/a06e415b14fb5bf86eedaef73311bfd7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DiscussionRepository | |
{ | |
public function __construct(DiscussionMapper $mapper) {...} | |
public function fetchDiscussion($id) | |
{ | |
$record = $this->mapper->select(['discussion_id' => $id]) | |
->with(['author']); | |
return $this->newDiscussion($record); | |
} | |
protected function newDiscussion($record) | |
{ | |
$discussionId = DiscussionId::createFrom($record->discussion_id); | |
$author = Author::createFrom($record->author); | |
return Discussion::createFrom($discussionId, $author); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment