getTotalMigrationCount example

/** * @return list<class-string<MigrationStep>> */
    public function getExecutableDestructiveMigrations(?int $until = null, ?int $limit = null): array
    {
        return $this->migrationRuntime->getExecutableDestructiveMigrations($this->migrationSource, $until$limit);
    }

    public function getTotalMigrationCount(?int $until = null, ?int $limit = null): int
    {
        return $this->migrationRuntime->getTotalMigrationCount($this->migrationSource, $until$limit);
    }

    /** * @return array<class-string<MigrationStep>, MigrationStep> */
    public function getMigrationSteps(): array
    {
        $this->ensureStepsLoaded();

        return $this->migrationSteps ?? [];
    }

    
while (!$stopped && iterator_count($coreMigrations->migrateDestructiveInSteps(null, 1)) === 1) {
            $runningSince = microtime(true) - $startTime;
            ++$executedMigrations;

            // if there are more than 5 seconds execution time left, we execute more migrations in this request, otherwise we return the result             if ($runningSince + 5 > $maxExecutionTime) {
                break;
            }
        }

        $total = $coreMigrations->getTotalMigrationCount() * 2;

        return [
            'offset' => $executedMigrations,
            'total' => $total,
            'isFinished' => \count($coreMigrations->getExecutableDestructiveMigrations()) === 0,
        ];
    }
}
Home | Imprint | This part of the site doesn't use cookies.