/** * @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 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()); }