src/Synapse/Migration/RunMigrationsCommand.php
protected function migrationsToRun()
    {
        // Get all migration files
        $path = APPDIR.'/src/'.str_replace('\\', '/', $this->migrationNamespace);

        if (! is_dir($path)) {
            return [];
        }

        $dir = new DirectoryIterator($path);

        $migrations = [];
        foreach ($dir as $file) {
            // Ignore directories and dotfiles (e.g. .DS_Store)
            if (! $file->isFile() or substr($file->getBasename(), 0, 1) === '.') {
                continue;
            }

            $class = $this->migrationNamespace.$file->getBasename('.php');

            $migrations[] = new $class;
        }

        $alreadyExecutedMigrations = $this->alreadyExecutedMigrations();

        $migrationsToRun = [];
        foreach ($migrations as $migration) {
            $compare = new ArrayObject([
                'description' => $migration->getDescription(),
                'timestamp'   => $migration->getTimestamp(),
            ]);

            if (in_array($compare, $alreadyExecutedMigrations)) {
                continue;
            }

            $migrationsToRun[] = $migration;
        }

        return $migrationsToRun;
    }
protected function migrationsToRun()
    {
        // Get all migration files
        $path = APPDIR.'/src/'.str_replace('\\', '/', $this->migrationNamespace);

        if (! is_dir($path)) {
            return [];
        }

        $dir = new DirectoryIterator($path);

        $migrations = [];
        foreach ($dir as $file) {
            // Ignore directories and dotfiles (e.g. .DS_Store)
            if (! $file->isFile() or substr($file->getBasename(), 0, 1) === '.') {
                continue;
            }

            $class = $this->migrationNamespace.$file->getBasename('.php');

            $migrations[] = new $class;
        }

        $alreadyExecutedMigrations = $this->alreadyExecutedMigrations();

        $migrationsToRun = [];
        foreach ($migrations as $migration) {
            $compare = new ArrayObject([
                'description' => $migration->getDescription(),
                'timestamp'   => $migration->getTimestamp(),
            ]);

            if (in_array($compare, $alreadyExecutedMigrations)) {
                continue;
            }

            $migrationsToRun[] = $migration;
        }

        return $migrationsToRun;
    }
protected function migrationsToRun ( ) { // Get all migration files $ path = APPDIR . '/src/' . str_replace ( '\\' , '/' , $ this -> migrationNamespace ) ; if ( ! is_dir ( $ path ) ) { return [ ] ; } $ dir = new DirectoryIterator ( $ path ) ; $ migrations = [ ] ; foreach ( $ dir as $ file ) { // Ignore directories and dotfiles (e.g. .DS_Store) if ( ! $ file -> isFile ( ) or substr ( $ file -> getBasename ( ) , 0 , 1 ) === '.' ) { continue ; } $ class = $ this -> migrationNamespace . $ file -> getBasename ( '.php' ) ; $ migrations [ ] = new $ class ; } $ alreadyExecutedMigrations = $ this -> alreadyExecutedMigrations ( ) ; $ migrationsToRun = [ ] ; foreach ( $ migrations as $ migration ) { $ compare = new ArrayObject ( [ 'description' => $ migration -> getDescription ( ) , 'timestamp' => $ migration -> getTimestamp ( ) , ] ) ; if ( in_array ( $ compare , $ alreadyExecutedMigrations ) ) { continue ; } $ migrationsToRun [ ] = $ migration ; } return $ migrationsToRun ; }
Determine all migrations that have not yet been run on the database

@return array
Determine all migrations that have not yet been run on the database