diff -r bbdc7f9aa25e -r 03b14b0fe101 vendor/bundles/Symfony/Bundle/DoctrineMigrationsBundle/Command/DoctrineCommand.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/Symfony/Bundle/DoctrineMigrationsBundle/Command/DoctrineCommand.php Fri Nov 25 18:55:43 2011 +0100 @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\DoctrineMigrationsBundle\Command; + +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Bundle\FrameworkBundle\Console\Application; +use Symfony\Bundle\DoctrineBundle\Command\DoctrineCommand as BaseCommand; +use Doctrine\DBAL\Migrations\Configuration\Configuration; + +/** + * Base class for Doctrine console commands to extend from. + * + * @author Fabien Potencier + */ +abstract class DoctrineCommand extends BaseCommand +{ + public static function configureMigrations(ContainerInterface $container, Configuration $configuration) + { + $dir = $container->getParameter('doctrine_migrations.dir_name'); + if (!file_exists($dir)) { + mkdir($dir, 0777, true); + } + + $configuration->setMigrationsNamespace($container->getParameter('doctrine_migrations.namespace')); + $configuration->setMigrationsDirectory($dir); + $configuration->registerMigrationsFromDirectory($dir); + $configuration->setName($container->getParameter('doctrine_migrations.name')); + $configuration->setMigrationsTableName($container->getParameter('doctrine_migrations.table_name')); + } +}