UpdateSchemaDoctrineODMCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 18 1
A execute() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of the Symfony package.
5
 *
6
 * (c) Fabien Potencier <[email protected]>
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 Saxulum\DoctrineMongodbOdmCommands\Command;
13
14
use Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\UpdateCommand;
15
use Symfony\Component\Console\Input\InputInterface;
16
use Symfony\Component\Console\Input\InputOption;
17
use Symfony\Component\Console\Output\OutputInterface;
18
19
/**
20
 * Command to update the database schema for a set of classes based on their
21
 * mappings.
22
 */
23
class UpdateSchemaDoctrineODMCommand extends UpdateCommand
24
{
25
    protected function configure()
26
    {
27
        parent::configure();
28
29
        $this
30
            ->setName('doctrine:mongodb:schema:update')
31
            ->addOption('dm', null, InputOption::VALUE_REQUIRED, 'The document manager to use for this command.')
32
            ->setHelp(<<<EOT
33
The <info>doctrine:mongodb:schema:update</info> command updates the default document manager's schema:
34
35
  <info>./app/console doctrine:mongodb:schema:update</info>
36
37
You can also optionally specify the name of a document manager to update the schema for:
38
39
  <info>./app/console doctrine:mongodb:schema:update --dm=default</info>
40
EOT
41
            );
42
    }
43
44
    protected function execute(InputInterface $input, OutputInterface $output)
45
    {
46
        DoctrineCommandHelper::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm'));
47
48
        parent::execute($input, $output);
49
    }
50
}
51