Skip to content

Commit bc6bc39

Browse files
jwagefabpot
authored andcommitted
Initial entry of new commands for migrations integration
1 parent ae82308 commit bc6bc39

6 files changed

+292
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
namespace Symfony\Framework\DoctrineBundle\Command;
4+
5+
use Symfony\Components\Console\Input\InputInterface;
6+
use Symfony\Components\Console\Output\OutputInterface;
7+
use Symfony\Components\Console\Input\InputOption;
8+
use DoctrineExtensions\Migrations\Tools\Console\Command\DiffCommand;
9+
10+
/*
11+
* This file is part of the Symfony framework.
12+
*
13+
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
14+
*
15+
* This source file is subject to the MIT license that is bundled
16+
* with this source code in the file LICENSE.
17+
*/
18+
19+
/**
20+
* Command for generate migration classes by comparing your current database schema
21+
* to your mapping information.
22+
*
23+
* @package Symfony
24+
* @subpackage Framework_DoctrineBundle
25+
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
26+
* @author Jonathan H. Wage <jonwage@gmail.com>
27+
*/
28+
class MigrationsDiffDoctrineCommand extends DiffCommand
29+
{
30+
protected function configure()
31+
{
32+
parent::configure();
33+
34+
$this
35+
->setName('doctrine:migrations:diff')
36+
->addOption('bundle', null, InputOption::PARAMETER_REQUIRED, 'The bundle to load migrations configuration from.')
37+
->addOption('em', null, InputOption::PARAMETER_OPTIONAL, 'The entity manager to use for this command.')
38+
;
39+
}
40+
41+
public function execute(InputInterface $input, OutputInterface $output)
42+
{
43+
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
44+
45+
$configuration = $this->_getMigrationConfiguration($input, $output);
46+
DoctrineCommand::configureMigrationsForBundle($this->application, $input->getOption('bundle'), $configuration);
47+
48+
parent::execute($input, $output);
49+
}
50+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
namespace Symfony\Framework\DoctrineBundle\Command;
4+
5+
use Symfony\Components\Console\Input\InputInterface;
6+
use Symfony\Components\Console\Output\OutputInterface;
7+
use Symfony\Components\Console\Input\InputOption;
8+
use DoctrineExtensions\Migrations\Tools\Console\Command\ExecuteCommand;
9+
10+
/*
11+
* This file is part of the Symfony framework.
12+
*
13+
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
14+
*
15+
* This source file is subject to the MIT license that is bundled
16+
* with this source code in the file LICENSE.
17+
*/
18+
19+
/**
20+
* Command for executing single migrations up or down manually.
21+
*
22+
* @package Symfony
23+
* @subpackage Framework_DoctrineBundle
24+
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
25+
* @author Jonathan H. Wage <jonwage@gmail.com>
26+
*/
27+
class MigrationsExecuteDoctrineCommand extends ExecuteCommand
28+
{
29+
protected function configure()
30+
{
31+
parent::configure();
32+
33+
$this
34+
->setName('doctrine:migrations:execute')
35+
->addOption('bundle', null, InputOption::PARAMETER_REQUIRED, 'The bundle to load migrations configuration from.')
36+
->addOption('em', null, InputOption::PARAMETER_OPTIONAL, 'The entity manager to use for this command.')
37+
;
38+
}
39+
40+
public function execute(InputInterface $input, OutputInterface $output)
41+
{
42+
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
43+
44+
$configuration = $this->_getMigrationConfiguration($input, $output);
45+
DoctrineCommand::configureMigrationsForBundle($this->application, $input->getOption('bundle'), $configuration);
46+
47+
parent::execute($input, $output);
48+
}
49+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
namespace Symfony\Framework\DoctrineBundle\Command;
4+
5+
use Symfony\Components\Console\Input\InputInterface;
6+
use Symfony\Components\Console\Output\OutputInterface;
7+
use Symfony\Components\Console\Input\InputOption;
8+
use DoctrineExtensions\Migrations\Tools\Console\Command\GenerateCommand;
9+
10+
/*
11+
* This file is part of the Symfony framework.
12+
*
13+
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
14+
*
15+
* This source file is subject to the MIT license that is bundled
16+
* with this source code in the file LICENSE.
17+
*/
18+
19+
/**
20+
* Command for generating new blank migration classes
21+
*
22+
* @package Symfony
23+
* @subpackage Framework_DoctrineBundle
24+
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
25+
* @author Jonathan H. Wage <jonwage@gmail.com>
26+
*/
27+
class MigrationsGenerateDoctrineCommand extends GenerateCommand
28+
{
29+
protected function configure()
30+
{
31+
parent::configure();
32+
33+
$this
34+
->setName('doctrine:migrations:generate')
35+
->addOption('bundle', null, InputOption::PARAMETER_REQUIRED, 'The bundle to load migrations configuration from.')
36+
->addOption('em', null, InputOption::PARAMETER_OPTIONAL, 'The entity manager to use for this command.')
37+
;
38+
}
39+
40+
public function execute(InputInterface $input, OutputInterface $output)
41+
{
42+
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
43+
44+
$configuration = $this->_getMigrationConfiguration($input, $output);
45+
DoctrineCommand::configureMigrationsForBundle($this->application, $input->getOption('bundle'), $configuration);
46+
47+
parent::execute($input, $output);
48+
}
49+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
namespace Symfony\Framework\DoctrineBundle\Command;
4+
5+
use Symfony\Components\Console\Input\InputInterface;
6+
use Symfony\Components\Console\Output\OutputInterface;
7+
use Symfony\Components\Console\Input\InputOption;
8+
use DoctrineExtensions\Migrations\Tools\Console\Command\MigrateCommand;
9+
10+
/*
11+
* This file is part of the Symfony framework.
12+
*
13+
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
14+
*
15+
* This source file is subject to the MIT license that is bundled
16+
* with this source code in the file LICENSE.
17+
*/
18+
19+
/**
20+
* Command for executing a migration to a specified version or the latest available version.
21+
*
22+
* @package Symfony
23+
* @subpackage Framework_DoctrineBundle
24+
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
25+
* @author Jonathan H. Wage <jonwage@gmail.com>
26+
*/
27+
class MigrationsMigrateDoctrineCommand extends MigrateCommand
28+
{
29+
protected function configure()
30+
{
31+
parent::configure();
32+
33+
$this
34+
->setName('doctrine:migrations:migrate')
35+
->addOption('bundle', null, InputOption::PARAMETER_REQUIRED, 'The bundle to load migrations configuration from.')
36+
->addOption('em', null, InputOption::PARAMETER_OPTIONAL, 'The entity manager to use for this command.')
37+
;
38+
}
39+
40+
public function execute(InputInterface $input, OutputInterface $output)
41+
{
42+
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
43+
44+
$configuration = $this->_getMigrationConfiguration($input, $output);
45+
DoctrineCommand::configureMigrationsForBundle($this->application, $input->getOption('bundle'), $configuration);
46+
47+
parent::execute($input, $output);
48+
}
49+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
namespace Symfony\Framework\DoctrineBundle\Command;
4+
5+
use Symfony\Components\Console\Input\InputInterface;
6+
use Symfony\Components\Console\Output\OutputInterface;
7+
use Symfony\Components\Console\Input\InputOption;
8+
use DoctrineExtensions\Migrations\Tools\Console\Command\StatusCommand;
9+
10+
/*
11+
* This file is part of the Symfony framework.
12+
*
13+
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
14+
*
15+
* This source file is subject to the MIT license that is bundled
16+
* with this source code in the file LICENSE.
17+
*/
18+
19+
/**
20+
* Command to view the status of a set of migrations.
21+
*
22+
* @package Symfony
23+
* @subpackage Framework_DoctrineBundle
24+
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
25+
* @author Jonathan H. Wage <jonwage@gmail.com>
26+
*/
27+
class MigrationsStatusDoctrineCommand extends StatusCommand
28+
{
29+
protected function configure()
30+
{
31+
parent::configure();
32+
33+
$this
34+
->setName('doctrine:migrations:status')
35+
->addOption('bundle', null, InputOption::PARAMETER_REQUIRED, 'The bundle to load migrations configuration from.')
36+
->addOption('em', null, InputOption::PARAMETER_OPTIONAL, 'The entity manager to use for this command.')
37+
;
38+
}
39+
40+
public function execute(InputInterface $input, OutputInterface $output)
41+
{
42+
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
43+
44+
$configuration = $this->_getMigrationConfiguration($input, $output);
45+
DoctrineCommand::configureMigrationsForBundle($this->application, $input->getOption('bundle'), $configuration);
46+
47+
parent::execute($input, $output);
48+
}
49+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
namespace Symfony\Framework\DoctrineBundle\Command;
4+
5+
use Symfony\Components\Console\Input\InputInterface;
6+
use Symfony\Components\Console\Output\OutputInterface;
7+
use Symfony\Components\Console\Input\InputOption;
8+
use DoctrineExtensions\Migrations\Tools\Console\Command\VersionCommand;
9+
10+
/*
11+
* This file is part of the Symfony framework.
12+
*
13+
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
14+
*
15+
* This source file is subject to the MIT license that is bundled
16+
* with this source code in the file LICENSE.
17+
*/
18+
19+
/**
20+
* Command for manually adding and deleting migration versions from the version table.
21+
*
22+
* @package Symfony
23+
* @subpackage Framework_DoctrineBundle
24+
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
25+
* @author Jonathan H. Wage <jonwage@gmail.com>
26+
*/
27+
class MigrationsVersionDoctrineCommand extends VersionCommand
28+
{
29+
protected function configure()
30+
{
31+
parent::configure();
32+
33+
$this
34+
->setName('doctrine:migrations:version')
35+
->addOption('bundle', null, InputOption::PARAMETER_REQUIRED, 'The bundle to load migrations configuration from.')
36+
->addOption('em', null, InputOption::PARAMETER_OPTIONAL, 'The entity manager to use for this command.')
37+
;
38+
}
39+
40+
public function execute(InputInterface $input, OutputInterface $output)
41+
{
42+
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
43+
44+
parent::execute($input, $output);
45+
}
46+
}

0 commit comments

Comments
 (0)