コード例 #1
0
ファイル: RetractPostHandler.php プロジェクト: flijten/blog
 /**
  * @param RetractPost $command
  */
 public function handle(RetractPost $command)
 {
     $draft = $this->postRepository->byId($command->postId);
     $draft->retract();
     $this->postRepository->save($draft);
 }
コード例 #2
0
ファイル: AddDraftHandler.php プロジェクト: flijten/blog
 /**
  * @param AddDraft $command
  * @throws InvalidArgumentException
  */
 public function handle(AddDraft $command)
 {
     $this->postRepository->save(Post::draft(new PostTitle($command->title), new PostIntroduction($command->introduction), new PostContent($command->content)));
 }
コード例 #3
0
ファイル: PublishPostHandler.php プロジェクト: flijten/blog
 /**
  * @param PublishDraft $command
  */
 public function handle(PublishDraft $command)
 {
     $draft = $this->postRepository->byId($command->postId);
     $draft->publish($command->postDateTime);
     $this->postRepository->save($draft);
 }