Example #1
0
 /**
  * @param BookAdded $event
  */
 public function onBookAdded(BookAdded $event)
 {
     $authors = array_map(function (AuthorAdded $author) {
         return new Author($author->getFirstName(), $author->getLastName());
     }, $event->getAuthors());
     $this->storage->upsert($event->getId()->getValue(), new Book($event->getId(), new Authors($authors), $event->getTitle(), $event->getISBN(), true, $event->getVersion()));
 }
Example #2
0
 /**
  * @param BookAdded $event
  */
 protected function applyBookAdded(BookAdded $event)
 {
     $this->id = $event->getId();
 }