1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the AntiMattr MongoDB Migrations Bundle, a library by Matthew Fitzgerald. |
5
|
|
|
* |
6
|
|
|
* (c) 2014 Matthew Fitzgerald |
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 AntiMattr\Bundle\MongoDBMigrationsBundle\Command; |
13
|
|
|
|
14
|
|
|
use AntiMattr\MongoDB\Migrations\Tools\Console\Command\ExecuteCommand; |
15
|
|
|
use Symfony\Bundle\FrameworkBundle\Console\Application; |
16
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
17
|
|
|
use Symfony\Component\Console\Input\InputOption; |
18
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @author Matthew Fitzgerald <[email protected]> |
22
|
|
|
*/ |
23
|
|
|
class MigrationsExecuteCommand extends ExecuteCommand |
24
|
|
|
{ |
25
|
1 |
|
protected function configure() |
26
|
|
|
{ |
27
|
1 |
|
parent::configure(); |
28
|
|
|
|
29
|
|
|
$this |
30
|
1 |
|
->setName('mongodb:migrations:execute') |
31
|
1 |
|
->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.', 'default_document_manager') |
32
|
|
|
; |
33
|
1 |
|
} |
34
|
|
|
|
35
|
|
|
public function execute(InputInterface $input, OutputInterface $output) |
36
|
|
|
{ |
37
|
|
|
/** @var Application $application */ |
38
|
|
|
$application = $this->getApplication(); |
39
|
|
|
CommandHelper::setApplicationDocumentManager($application, $input->getOption('dm')); |
|
|
|
|
40
|
|
|
|
41
|
|
|
$configuration = $this->getMigrationConfiguration($input, $output); |
42
|
|
|
CommandHelper::configureMigrations($application->getKernel()->getContainer(), $configuration); |
43
|
|
|
|
44
|
|
|
return parent::execute($input, $output); |
|
|
|
|
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|