/** * @param CreateUserCommand $command * @return void */ public function handle(CreateUserCommand $command) { $user = User::create($command->getUserId(), $command->getName()); $this->usersRepository->save($user); }
/** * @param User $user * @return void */ public function save(User $user) { $recordedEvents = $user->getRecordedEvents(); $this->eventStore->append($recordedEvents); $this->projectionManager->notify($recordedEvents); }