public function getMigrationsToExecute($direction, $to)
    {
        if ($direction === Version::DIRECTION_DOWN) {
            $this->throwMethodIsNotAllowedException('Migration down is not allowed.');
        }

        $migrationVersionsToExecute = [];
        $allMigrationVersions = $this->getMigrations();
        $migratedVersions = $this->getMigratedVersions();

        foreach ($allMigrationVersions as $version) {
            if ($to < $version->getVersion()) {
                $this->throwMethodIsNotAllowedException('Partial migration up in not allowed.');
            }

            if ($this->shouldExecuteMigration($version, $migratedVersions)) {
                $migrationVersionsToExecute[$version->getVersion()] = $version;
            }
        }

        return $migrationVersionsToExecute;
    }
public function getMigrationsToExecute($direction, $to)
    {
        if ($direction === Version::DIRECTION_DOWN) {
            $this->throwMethodIsNotAllowedException('Migration down is not allowed.');
        }

        $migrationVersionsToExecute = [];
        $allMigrationVersions = $this->getMigrations();
        $migratedVersions = $this->getMigratedVersions();

        foreach ($allMigrationVersions as $version) {
            if ($to < $version->getVersion()) {
                $this->throwMethodIsNotAllowedException('Partial migration up in not allowed.');
            }

            if ($this->shouldExecuteMigration($version, $migratedVersions)) {
                $migrationVersionsToExecute[$version->getVersion()] = $version;
            }
        }

        return $migrationVersionsToExecute;
    }
public function getMigrationsToExecute ( $ direction , $ to ) { if ( $ direction === Version :: DIRECTION_DOWN ) { $ this -> throwMethodIsNotAllowedException ( 'Migration down is not allowed.' ) ; } $ migrationVersionsToExecute = [ ] ; $ allMigrationVersions = $ this -> getMigrations ( ) ; $ migratedVersions = $ this -> getMigratedVersions ( ) ; foreach ( $ allMigrationVersions as $ version ) { if ( $ to < $ version -> getVersion ( ) ) { $ this -> throwMethodIsNotAllowedException ( 'Partial migration up in not allowed.' ) ; } if ( $ this -> shouldExecuteMigration ( $ version , $ migratedVersions ) ) { $ migrationVersionsToExecute [ $ version -> getVersion ( ) ] = $ version ; } } return $ migrationVersionsToExecute ; }
Returns the array of migrations to executed based on the given direction and target version number.
Because of multiple migrations locations and the lock file, only complete UP migrations are allowed.

@param string $direction the direction we are migrating (DOWN is not allowed)
@param string $to the version to migrate to (partial migrations are not allowed)

@throws \Shopsys\MigrationBundle\Component\Doctrine\Migrations\Exception\MethodIsNotAllowedException
@return \Doctrine\DBAL\Migrations\Version[] $migrations the array of migrations we can execute
Returns the array of migrations to executed based on the given direction and target version number . Because of multiple migrations locations and the lock file only complete UP migrations are allowed .