/** * {@inheritdoc} */ public function findById(UuidInterface $id) { $eventStream = $this->eventStore->getEventStream($id); if ($eventStream->isEmpty()) { return null; } $eventProvider = $this->createEventProvider(); $eventProvider->applyCommittedEventStream($eventStream); return $eventProvider; }
public function testMultipleEventSources() { $cartId = Uuid::uuid4(); $customer = $this->createCustomer(); $customer->addCart($cartId); $cart = $customer->getCart($cartId); $entry = new CartEntry(Uuid::uuid4(), 1, new Product('abc', 10.0, 'EUR')); $cart->addEntry($entry); $cart->removeEntry($entry->getId()); $address = new CustomerAddress(Uuid::uuid4(), CustomerAddress::TYPE_BILLING, 'lkj', '1', '54321', 'onm', 'rqp', 'uts', '13579'); $customer->addAddress($address); $customer->removeAddress($address->getId()); $persisted = $this->saveCustomer($customer); $address = $persisted->getAddress($address->getId()); $cart = $persisted->getCart($cart->getId()); $entry = $cart->getEntry($entry->getId()); $eventStream = $this->eventStore->getEventStream($customer->getId()); $this->assertNull($address); $this->assertNull($entry); $this->assertCount(7, $eventStream); }