Exemplo n.º 1
0
 /**
  * @param AddAuthor $command
  */
 private function handleAddAuthor(AddAuthor $command)
 {
     /* @var $book \AppBundle\Domain\Aggregate\Book */
     $book = $this->repository->findById($command->getId());
     $book->addAuthor($command->getFirstName(), $command->getLastName());
     $this->repository->store($book, $command->getVersion());
 }
Exemplo n.º 2
0
 /**
  * @param ReturnBook $command
  */
 public function handleReturnBook(ReturnBook $command)
 {
     /* @var $book \AppBundle\Domain\Aggregate\Book */
     $book = $this->repository->findById($command->getId());
     $book->checkIn();
     $this->repository->store($book, $command->getVersion());
 }
Exemplo n.º 3
0
 /**
  * @param AddBook $command
  */
 private function handleAddBook(AddBook $command)
 {
     $book = Book::add($command->getId(), $command->getAuthors(), $command->getTitle(), $command->getISBN());
     $this->repository->store($book);
 }
Exemplo n.º 4
0
 /**
  * @param CreateUser $command
  */
 public function handleCreateUser(CreateUser $command)
 {
     $user = User::create($command->getId(), $command->getUserName(), $command->getEmailAddress(), $command->getFullName());
     $this->repository->store($user);
 }