/** * @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()); }
/** * @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()); }
/** * @param AddBook $command */ private function handleAddBook(AddBook $command) { $book = Book::add($command->getId(), $command->getAuthors(), $command->getTitle(), $command->getISBN()); $this->repository->store($book); }
/** * @param CreateUser $command */ public function handleCreateUser(CreateUser $command) { $user = User::create($command->getId(), $command->getUserName(), $command->getEmailAddress(), $command->getFullName()); $this->repository->store($user); }