Doctrine Migrations with own database connection instead of using migrations-db.php file
<p>I have been trying to use my own <strong>Doctrine\Dbal\Connection</strong> object with Doctrine Migrations, this is what I got so far, but it keeps telling me to supply a <strong>--db-configuration</strong> file, which is not what I want.</p>

<pre><code>// CLI script for Doctrine Migrations
$app = require 'bootstrap.php';

$cli = new Symfony\Component\Console\Application('Doctrine CLI');

$cli-&gt;addCommands([
    new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand(),
    new \Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand(),
    new \Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand(),
    new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand(),
    new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand(),
    new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand()
]);

$helperSet = new Symfony\Component\Console\Helper\HelperSet([
    // Doctrine\DBAL\Connection $app-&gt;getContainer()-&gt;db
    'connection' =&gt; new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($app-&gt;getContainer()-&gt;db),
    'dialog' =&gt; new \Symfony\Component\Console\Helper\QuestionHelper(),
]);

$cli-&gt;setHelperSet($helperSet);

$cli-&gt;run();
</code></pre>

<p>Exception:</p>

<pre><code>[InvalidArgumentException]                                                                                 
You have to specify a --db-configuration file or pass a Database Connection as a dependency to the Migrat  
ions.  
</code></pre>