Преглед на файлове

Moved migrations-specific method out of DoctrineBundle\Command\DoctrineCommand and into the migrations bundle.

Greg Thornton преди 15 години
родител
ревизия
5a09375dc4

+ 0 - 19
src/Symfony/Framework/DoctrineBundle/Command/DoctrineCommand.php

@@ -17,8 +17,6 @@ use Doctrine\ORM\Tools\DisconnectedClassMetadataFactory;
 use Doctrine\ORM\Mapping\ClassMetadata;
 use Doctrine\ORM\Mapping\ClassMetadataInfo;
 use Doctrine\ORM\Tools\EntityGenerator;
-use DoctrineExtensions\Migrations\Configuration\Configuration;
-use Doctrine\Common\Util\Inflector;
 
 /*
  * This file is part of the Symfony framework.
@@ -38,23 +36,6 @@ use Doctrine\Common\Util\Inflector;
  */
 abstract class DoctrineCommand extends Command
 {
-    public static function configureMigrationsForBundle(Application $application, $bundle, Configuration $configuration)
-    {
-            $configuration->setMigrationsNamespace($bundle.'\DoctrineMigrations');
-
-            $dirs = $application->getKernel()->getBundleDirs();
-
-            $tmp = str_replace('\\', '/', $bundle);
-            $namespace = str_replace('/', '\\', dirname($tmp));
-            $bundle = basename($tmp);
-
-            $dir = $dirs[$namespace].'/'.$bundle.'/DoctrineMigrations';
-            $configuration->setMigrationsDirectory($dir);
-            $configuration->registerMigrationsFromDirectory($dir);
-            $configuration->setName($bundle.' Migrations');
-            $configuration->setMigrationsTableName(Inflector::tableize($bundle).'_migration_versions');
-    }
-
     public static function setApplicationEntityManager(Application $application, $emName)
     {
         $container = $application->getKernel()->getContainer();

+ 44 - 0
src/Symfony/Framework/DoctrineMigrationsBundle/Command/DoctrineCommand.php

@@ -0,0 +1,44 @@
+<?php
+
+namespace Symfony\Framework\DoctrineMigrationsBundle\Command;
+
+use Symfony\Framework\WebBundle\Console\Application;
+use Symfony\Framework\DoctrineBundle\Command\DoctrineCommand as BaseCommand;
+use Doctrine\DBAL\Migrations\Configuration\Configuration;
+use Doctrine\Common\Util\Inflector;
+
+/*
+ * This file is part of the Symfony framework.
+ *
+ * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+/**
+ * Base class for Doctrine console commands to extend from.
+ *
+ * @package    Symfony
+ * @subpackage Framework_DoctrineBundle
+ * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
+ */
+abstract class DoctrineCommand extends BaseCommand
+{
+    public static function configureMigrationsForBundle(Application $application, $bundle, Configuration $configuration)
+    {
+        $configuration->setMigrationsNamespace($bundle.'\DoctrineMigrations');
+        
+        $dirs = $application->getKernel()->getBundleDirs();
+        
+        $tmp = str_replace('\\', '/', $bundle);
+        $namespace = str_replace('/', '\\', dirname($tmp));
+        $bundle = basename($tmp);
+        
+        $dir = $dirs[$namespace].'/'.$bundle.'/DoctrineMigrations';
+        $configuration->setMigrationsDirectory($dir);
+        $configuration->registerMigrationsFromDirectory($dir);
+        $configuration->setName($bundle.' Migrations');
+        $configuration->setMigrationsTableName(Inflector::tableize($bundle).'_migration_versions');
+    }
+}

+ 0 - 1
src/Symfony/Framework/DoctrineMigrationsBundle/Command/MigrationsDiffDoctrineCommand.php

@@ -5,7 +5,6 @@ namespace Symfony\Framework\DoctrineMigrationsBundle\Command;
 use Symfony\Components\Console\Input\InputInterface;
 use Symfony\Components\Console\Output\OutputInterface;
 use Symfony\Components\Console\Input\InputOption;
-use Symfony\Framework\DoctrineBundle\Command\DoctrineCommand;
 use Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand;
 
 /*

+ 0 - 1
src/Symfony/Framework/DoctrineMigrationsBundle/Command/MigrationsExecuteDoctrineCommand.php

@@ -5,7 +5,6 @@ namespace Symfony\Framework\DoctrineMigrationsBundle\Command;
 use Symfony\Components\Console\Input\InputInterface;
 use Symfony\Components\Console\Output\OutputInterface;
 use Symfony\Components\Console\Input\InputOption;
-use Symfony\Framework\DoctrineBundle\Command\DoctrineCommand;
 use Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand;
 
 /*

+ 0 - 1
src/Symfony/Framework/DoctrineMigrationsBundle/Command/MigrationsGenerateDoctrineCommand.php

@@ -5,7 +5,6 @@ namespace Symfony\Framework\DoctrineMigrationsBundle\Command;
 use Symfony\Components\Console\Input\InputInterface;
 use Symfony\Components\Console\Output\OutputInterface;
 use Symfony\Components\Console\Input\InputOption;
-use Symfony\Framework\DoctrineBundle\Command\DoctrineCommand;
 use Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand;
 
 /*

+ 0 - 1
src/Symfony/Framework/DoctrineMigrationsBundle/Command/MigrationsMigrateDoctrineCommand.php

@@ -5,7 +5,6 @@ namespace Symfony\Framework\DoctrineMigrationsBundle\Command;
 use Symfony\Components\Console\Input\InputInterface;
 use Symfony\Components\Console\Output\OutputInterface;
 use Symfony\Components\Console\Input\InputOption;
-use Symfony\Framework\DoctrineBundle\Command\DoctrineCommand;
 use Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand;
 
 /*

+ 0 - 1
src/Symfony/Framework/DoctrineMigrationsBundle/Command/MigrationsStatusDoctrineCommand.php

@@ -5,7 +5,6 @@ namespace Symfony\Framework\DoctrineMigrationsBundle\Command;
 use Symfony\Components\Console\Input\InputInterface;
 use Symfony\Components\Console\Output\OutputInterface;
 use Symfony\Components\Console\Input\InputOption;
-use Symfony\Framework\DoctrineBundle\Command\DoctrineCommand;
 use Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand;
 
 /*

+ 0 - 1
src/Symfony/Framework/DoctrineMigrationsBundle/Command/MigrationsVersionDoctrineCommand.php

@@ -5,7 +5,6 @@ namespace Symfony\Framework\DoctrineMigrationsBundle\Command;
 use Symfony\Components\Console\Input\InputInterface;
 use Symfony\Components\Console\Output\OutputInterface;
 use Symfony\Components\Console\Input\InputOption;
-use Symfony\Framework\DoctrineBundle\Command\DoctrineCommand;
 use Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand;
 
 /*