src/Graviton/MigrationBundle/Command/MongodbMigrateCommand.php
private function getConfiguration($filepath, $output)
    {
        $outputWriter = new OutputWriter(
            function ($message) use ($output) {
                return $output->writeln($message);
            }
        );

        $info = pathinfo($filepath);
        $namespace = 'AntiMattr\MongoDB\Migrations\Configuration';
        $class = $info['extension'] === 'xml' ? 'XmlConfiguration' : 'YamlConfiguration';
        $class = sprintf('%s\%s', $namespace, $class);
        $configuration = new $class($this->documentManager->getDocumentManager()->getConnection(), $outputWriter);

        // register databsae name before loading to ensure that loading does not fail
        $configuration->setMigrationsDatabaseName($this->databaseName);

        // load additional config from migrations.(yml|xml)
        $configuration->load($filepath);

        return $configuration;
    }
private function getConfiguration($filepath, $output)
    {
        $outputWriter = new OutputWriter(
            function ($message) use ($output) {
                return $output->writeln($message);
            }
        );

        $info = pathinfo($filepath);
        $namespace = 'AntiMattr\MongoDB\Migrations\Configuration';
        $class = $info['extension'] === 'xml' ? 'XmlConfiguration' : 'YamlConfiguration';
        $class = sprintf('%s\%s', $namespace, $class);
        $configuration = new $class($this->documentManager->getDocumentManager()->getConnection(), $outputWriter);

        // register databsae name before loading to ensure that loading does not fail
        $configuration->setMigrationsDatabaseName($this->databaseName);

        // load additional config from migrations.(yml|xml)
        $configuration->load($filepath);

        return $configuration;
    }
private function getConfiguration ( $ filepath , $ output ) { $ outputWriter = new OutputWriter ( function ( $ message ) use ( $ output ) { return $ output -> writeln ( $ message ) ; } ) ; $ info = pathinfo ( $ filepath ) ; $ namespace = 'AntiMattr\MongoDB\Migrations\Configuration' ; $ class = $ info [ 'extension' ] === 'xml' ? 'XmlConfiguration' : 'YamlConfiguration' ; $ class = sprintf ( '%s\%s' , $ namespace , $ class ) ; $ configuration = new $ class ( $ this -> documentManager -> getDocumentManager ( ) -> getConnection ( ) , $ outputWriter ) ; // register databsae name before loading to ensure that loading does not fail $ configuration -> setMigrationsDatabaseName ( $ this -> databaseName ) ; // load additional config from migrations.(yml|xml) $ configuration -> load ( $ filepath ) ; return $ configuration ; }
get configration object for migration script

This is based on antromattr/mongodb-migartion code but extends it so we can inject
non local stuff centrally.

@param string $filepath path to configuration file
@param Output $output   ouput interface need by config parser to do stuff

@return AntiMattr\MongoDB\Migrations\Configuration\Configuration
get configration object for migration script