Example #1
0
 public function handleWritePost(WritePost $command)
 {
     $author = $this->authors->read($command->getAuthor());
     $post = new Post(time() . '_' . preg_replace('/[^a-zA-Z0-9]/', '', $command->getTitle()), $author->getEmail(), $command->getTitle(), $command->getText());
     $post->setPublished($command->getPublished());
     $post->setTags($command->getTags());
     $this->posts->create($post);
     return $post;
 }
Example #2
0
 private function assembleAuthor(Post $post)
 {
     $author = $this->authorService->show($post->getAuthor()->getId());
     return ['name' => $author->getName()];
 }