コード例 #1
0
ファイル: CreateUserHandler.php プロジェクト: martyn82/apha
 /**
  * @param Command $command
  */
 public function handle(Command $command)
 {
     $commandName = get_class($command);
     $this->logger->info('Handle command', ['command' => $commandName, 'handler' => get_class($this)]);
     $user = User::create($command->getId());
     $this->repository->store($user);
 }
コード例 #2
0
ファイル: ToDoCommandHandler.php プロジェクト: martyn82/apha
 /**
  * @param MarkItemDone $command
  */
 public function handleMarkItemDone(MarkItemDone $command)
 {
     /* @var $item ToDoItem */
     $item = $this->repository->findById($command->getIdentity());
     $item->markDone($command);
     $this->repository->store($item);
 }
コード例 #3
0
ファイル: ScenarioTest.php プロジェクト: martyn82/apha
 /**
  * @param ScenarioTest_DoThat $command
  */
 public function handleScenarioTest_DoThat(ScenarioTest_DoThat $command)
 {
     $aggregate = $this->repository->findById($command->getId());
     $aggregate->doThat($command);
     $this->repository->store($aggregate, $aggregate->getVersion());
 }