/** * @param InputInterface $input * @param OutputInterface $output */ protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln("Reload read store from event store."); $this->documents->clear(); $output->write("Loading aggregate identities... "); $ids = $this->events->getAggregateIds(); $output->writeln("done."); $total = count($ids); $current = 0; foreach ($ids as $id) { /* @var $id Uuid */ $eventStream = $this->events->getEventsForAggregate($id); $aggregate = new UserReplay($id); $aggregate->loadFromHistory($eventStream); $document = $this->createDocumentFromAggregate($aggregate, $eventStream->size()); $this->documents->upsert($id, $document); $output->write(sprintf("%d/%d\r", ++$current, $total)); } $output->writeln("\nDone."); }
/** * @param AggregateRoot $aggregate * @param integer $expectedPlayHead * @throws ConcurrencyException */ public function store(AggregateRoot $aggregate, $expectedPlayHead = -1) { $this->storage->save($aggregate->getId(), $aggregate->getUncommittedChanges(), $expectedPlayHead); }
public function testGetAggregateIdsCallsFindIdentitiesOnStorage() { $eventBus = $this->getEventBus(); $storage = $this->getStorage(); $serializer = $this->getSerializer(); $map = $this->getEventClassMap(); $storage->expects(self::once())->method('findIdentities')->will(self::returnValue(['id'])); $store = new EventStore($eventBus, $storage, $serializer, $map); $store->getAggregateIds(); }