vendor/bundles/Symfony/Bundle/DoctrineMigrationsBundle/Command/DoctrineCommand.php
equal
deleted
inserted
replaced
|
1 <?php |
|
2 |
|
3 /* |
|
4 * This file is part of the Symfony package. |
|
5 * |
|
6 * (c) Fabien Potencier <fabien@symfony.com> |
|
7 * |
|
8 * For the full copyright and license information, please view the LICENSE |
|
9 * file that was distributed with this source code. |
|
10 */ |
|
11 |
|
12 namespace Symfony\Bundle\DoctrineMigrationsBundle\Command; |
|
13 |
|
14 use Symfony\Component\DependencyInjection\ContainerInterface; |
|
15 use Symfony\Bundle\FrameworkBundle\Console\Application; |
|
16 use Symfony\Bundle\DoctrineBundle\Command\DoctrineCommand as BaseCommand; |
|
17 use Doctrine\DBAL\Migrations\Configuration\Configuration; |
|
18 |
|
19 /** |
|
20 * Base class for Doctrine console commands to extend from. |
|
21 * |
|
22 * @author Fabien Potencier <fabien@symfony.com> |
|
23 */ |
|
24 abstract class DoctrineCommand extends BaseCommand |
|
25 { |
|
26 public static function configureMigrations(ContainerInterface $container, Configuration $configuration) |
|
27 { |
|
28 $dir = $container->getParameter('doctrine_migrations.dir_name'); |
|
29 if (!file_exists($dir)) { |
|
30 mkdir($dir, 0777, true); |
|
31 } |
|
32 |
|
33 $configuration->setMigrationsNamespace($container->getParameter('doctrine_migrations.namespace')); |
|
34 $configuration->setMigrationsDirectory($dir); |
|
35 $configuration->registerMigrationsFromDirectory($dir); |
|
36 $configuration->setName($container->getParameter('doctrine_migrations.name')); |
|
37 $configuration->setMigrationsTableName($container->getParameter('doctrine_migrations.table_name')); |
|
38 } |
|
39 } |