MigrationStep example

/** @var MigrationManager $manager */
        $manager = $this->container->get('migration.manager');

        $currentVersion = $manager->getCurrentVersion();

        $versions = $manager->getMigrationsForVersion($currentVersion);

        $progress = $this->IOHelper->createProgressBar(\count($versions));
        $progress->start();

        $step = new MigrationStep($manager);
        $offset = 0;
        do {
            $progress->setProgress($offset);
            $result = $step->run($offset);
            if ($result instanceof ErrorResult) {
                throw new Exception($result->getMessage(), 0, $result->getException());
            }

            $offset = $result->getOffset();
            $progress->setProgress($offset);
        } while ($result instanceof ValidResult);
        
$offset = $this->request->get('offset');
        $result = $snippetStep->run($offset);

        $this->toJson(200, $this->resultMapper->toExtJs($result));
    }

    public function applyMigrations()
    {
        /** @var Manager $migrationManger */
        $migrationManger = $this->container->get('migration.manager');
        $migrationStep = new MigrationStep($migrationManger);

        $offset = $this->request->get('offset');
        $total = $this->request->get('total');
        $result = $migrationStep->run($offset$total);

        $this->toJson(200, $this->resultMapper->toExtJs($result));
    }

    /** * @throws RuntimeException */
    
Home | Imprint | This part of the site doesn't use cookies.