From 5c2c16f57e56c3d001d2b219889582f33ac2d391 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 22 Apr 2011 12:11:08 +0200 Subject: [PATCH] moved DoctrineMigrationsBundle to its own repository (https://github.com/symfony/DoctrineMigrationsBundle) --- .../Command/DoctrineCommand.php | 39 ------------- .../Command/MigrationsDiffDoctrineCommand.php | 47 --------------- .../MigrationsExecuteDoctrineCommand.php | 46 --------------- .../MigrationsGenerateDoctrineCommand.php | 46 --------------- .../MigrationsMigrateDoctrineCommand.php | 46 --------------- .../MigrationsStatusDoctrineCommand.php | 46 --------------- .../MigrationsVersionDoctrineCommand.php | 46 --------------- .../DependencyInjection/Configuration.php | 36 ------------ .../DoctrineMigrationsExtension.php | 57 ------------------- .../DoctrineMigrationsBundle.php | 24 -------- 10 files changed, 433 deletions(-) delete mode 100644 src/Symfony/Bundle/DoctrineMigrationsBundle/Command/DoctrineCommand.php delete mode 100644 src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsDiffDoctrineCommand.php delete mode 100644 src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsExecuteDoctrineCommand.php delete mode 100644 src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsGenerateDoctrineCommand.php delete mode 100644 src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsMigrateDoctrineCommand.php delete mode 100644 src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsStatusDoctrineCommand.php delete mode 100644 src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsVersionDoctrineCommand.php delete mode 100644 src/Symfony/Bundle/DoctrineMigrationsBundle/DependencyInjection/Configuration.php delete mode 100644 src/Symfony/Bundle/DoctrineMigrationsBundle/DependencyInjection/DoctrineMigrationsExtension.php delete mode 100644 src/Symfony/Bundle/DoctrineMigrationsBundle/DoctrineMigrationsBundle.php diff --git a/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/DoctrineCommand.php b/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/DoctrineCommand.php deleted file mode 100644 index 01aaa4225498..000000000000 --- a/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/DoctrineCommand.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * 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')); - } -} diff --git a/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsDiffDoctrineCommand.php b/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsDiffDoctrineCommand.php deleted file mode 100644 index 31864d266ce9..000000000000 --- a/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsDiffDoctrineCommand.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * 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\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputOption; -use Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand; - -/** - * Command for generate migration classes by comparing your current database schema - * to your mapping information. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class MigrationsDiffDoctrineCommand extends DiffCommand -{ - protected function configure() - { - parent::configure(); - - $this - ->setName('doctrine:migrations:diff') - ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command.') - ; - } - - public function execute(InputInterface $input, OutputInterface $output) - { - DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); - - $configuration = $this->getMigrationConfiguration($input, $output); - DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration); - - parent::execute($input, $output); - } -} diff --git a/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsExecuteDoctrineCommand.php b/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsExecuteDoctrineCommand.php deleted file mode 100644 index fce0e10730dc..000000000000 --- a/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsExecuteDoctrineCommand.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * 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\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputOption; -use Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand; - -/** - * Command for executing single migrations up or down manually. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class MigrationsExecuteDoctrineCommand extends ExecuteCommand -{ - protected function configure() - { - parent::configure(); - - $this - ->setName('doctrine:migrations:execute') - ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command.') - ; - } - - public function execute(InputInterface $input, OutputInterface $output) - { - DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); - - $configuration = $this->getMigrationConfiguration($input, $output); - DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration); - - parent::execute($input, $output); - } -} diff --git a/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsGenerateDoctrineCommand.php b/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsGenerateDoctrineCommand.php deleted file mode 100644 index dfee20d24fb4..000000000000 --- a/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsGenerateDoctrineCommand.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * 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\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputOption; -use Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand; - -/** - * Command for generating new blank migration classes - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class MigrationsGenerateDoctrineCommand extends GenerateCommand -{ - protected function configure() - { - parent::configure(); - - $this - ->setName('doctrine:migrations:generate') - ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command.') - ; - } - - public function execute(InputInterface $input, OutputInterface $output) - { - DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); - - $configuration = $this->getMigrationConfiguration($input, $output); - DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration); - - parent::execute($input, $output); - } -} diff --git a/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsMigrateDoctrineCommand.php b/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsMigrateDoctrineCommand.php deleted file mode 100644 index 1ae8261bc0d4..000000000000 --- a/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsMigrateDoctrineCommand.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * 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\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputOption; -use Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand; - -/** - * Command for executing a migration to a specified version or the latest available version. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class MigrationsMigrateDoctrineCommand extends MigrateCommand -{ - protected function configure() - { - parent::configure(); - - $this - ->setName('doctrine:migrations:migrate') - ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command.') - ; - } - - public function execute(InputInterface $input, OutputInterface $output) - { - DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); - - $configuration = $this->getMigrationConfiguration($input, $output); - DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration); - - parent::execute($input, $output); - } -} diff --git a/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsStatusDoctrineCommand.php b/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsStatusDoctrineCommand.php deleted file mode 100644 index 0e10833c3ff9..000000000000 --- a/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsStatusDoctrineCommand.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * 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\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputOption; -use Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand; - -/** - * Command to view the status of a set of migrations. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class MigrationsStatusDoctrineCommand extends StatusCommand -{ - protected function configure() - { - parent::configure(); - - $this - ->setName('doctrine:migrations:status') - ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command.') - ; - } - - public function execute(InputInterface $input, OutputInterface $output) - { - DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); - - $configuration = $this->getMigrationConfiguration($input, $output); - DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration); - - parent::execute($input, $output); - } -} diff --git a/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsVersionDoctrineCommand.php b/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsVersionDoctrineCommand.php deleted file mode 100644 index 16753729e92f..000000000000 --- a/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsVersionDoctrineCommand.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * 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\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputOption; -use Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand; - -/** - * Command for manually adding and deleting migration versions from the version table. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class MigrationsVersionDoctrineCommand extends VersionCommand -{ - protected function configure() - { - parent::configure(); - - $this - ->setName('doctrine:migrations:version') - ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command.') - ; - } - - public function execute(InputInterface $input, OutputInterface $output) - { - DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); - - $configuration = $this->getMigrationConfiguration($input, $output); - DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration); - - parent::execute($input, $output); - } -} diff --git a/src/Symfony/Bundle/DoctrineMigrationsBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/DoctrineMigrationsBundle/DependencyInjection/Configuration.php deleted file mode 100644 index 93d56b12e196..000000000000 --- a/src/Symfony/Bundle/DoctrineMigrationsBundle/DependencyInjection/Configuration.php +++ /dev/null @@ -1,36 +0,0 @@ - - */ -class Configuration implements ConfigurationInterface -{ - /** - * Generates the configuration tree builder. - * - * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder - */ - public function getConfigTreeBuilder() - { - $treeBuilder = new TreeBuilder(); - $rootNode = $treeBuilder->root('doctrine_migrations', 'array'); - - $rootNode - ->children() - ->scalarNode('dir_name')->defaultValue('%kernel.root_dir%/DoctrineMigrations')->cannotBeEmpty()->end() - ->scalarNode('namespace')->defaultValue('Application\Migrations')->cannotBeEmpty()->end() - ->scalarNode('table_name')->defaultValue('migration_versions')->cannotBeEmpty()->end() - ->scalarNode('name')->defaultValue('Application Migrations')->end() - ->end() - ; - - return $treeBuilder; - } -} diff --git a/src/Symfony/Bundle/DoctrineMigrationsBundle/DependencyInjection/DoctrineMigrationsExtension.php b/src/Symfony/Bundle/DoctrineMigrationsBundle/DependencyInjection/DoctrineMigrationsExtension.php deleted file mode 100644 index d9c6e332f3ad..000000000000 --- a/src/Symfony/Bundle/DoctrineMigrationsBundle/DependencyInjection/DoctrineMigrationsExtension.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\DoctrineMigrationsBundle\DependencyInjection; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; -use Symfony\Component\Config\Definition\Processor; - -/** - * DoctrineMigrationsExtension. - * - * @author Lukas Kahwe Smith - */ -class DoctrineMigrationsExtension extends Extension -{ - /** - * Responds to the twig configuration parameter. - * - * @param array $configs - * @param ContainerBuilder $container - */ - public function load(array $configs, ContainerBuilder $container) - { - $processor = new Processor(); - $configuration = new Configuration(); - - $config = $processor->processConfiguration($configuration, $configs); - - foreach ($config as $key => $value) { - $container->setParameter($this->getAlias().'.'.$key, $value); - } - } - - /** - * Returns the base path for the XSD files. - * - * @return string The XSD base path - */ - public function getXsdValidationBasePath() - { - return __DIR__.'/../Resources/config/schema'; - } - - public function getNamespace() - { - return 'http://symfony.com/schema/dic/doctrine/migrations'; - } -} diff --git a/src/Symfony/Bundle/DoctrineMigrationsBundle/DoctrineMigrationsBundle.php b/src/Symfony/Bundle/DoctrineMigrationsBundle/DoctrineMigrationsBundle.php deleted file mode 100644 index 4110c95d2cf5..000000000000 --- a/src/Symfony/Bundle/DoctrineMigrationsBundle/DoctrineMigrationsBundle.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\DoctrineMigrationsBundle; - -use Symfony\Component\HttpKernel\Bundle\Bundle; - -/** - * Bundle. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class DoctrineMigrationsBundle extends Bundle -{ -}