public function collectAllForVersion(string
$version, string
$mode = self::VERSION_SELECTION_ALL
): MigrationCollection
{ $safeMajorVersion =
$this->
getLastSafeMajorVersion($version,
$mode);
$namespaces =
[];
for ($major = 3;
$safeMajorVersion >= 3 &&
$major <=
$safeMajorVersion; ++
$major) { $namespaces[] =
$this->
getSource('core.V6_' .
$major);
} $namespaces[] =
$this->
getSource('core'
);
$source =
new MigrationSource('allForVersion',
$namespaces);
return new MigrationCollection($source,
$this->migrationRuntime,
$this->connection,
$this->logger
);
} public function getLastSafeMajorVersion(string
$currentVersion, string
$mode = self::VERSION_SELECTION_ALL
): int
{ if (!\
in_array($mode, self::VALID_VERSION_SELECTION_SAFE_VALUES, true
)) { throw new \
RuntimeException(sprintf( 'mode needs to be one of these values: "%s"',
implode('", "', self::VALID_VERSION_SELECTION_SAFE_VALUES
) ));
}