migrationRepository = $migrationRepository; $this->metadataStorage = $metadataStorage; } /** * @throws RollupFailed */ public function rollup() : Version { $versions = $this->migrationRepository->getMigrations(); if (count($versions) === 0) { throw RollupFailed::noMigrationsFound(); } if (count($versions) > 1) { throw RollupFailed::tooManyMigrations(); } $this->metadataStorage->reset(); $result = new ExecutionResult($versions->getItems()[0]->getVersion()); $this->metadataStorage->complete($result); return $result->getVersion(); } }