Completed
Pull Request — master (#247)
by Tomáš
02:52
created

GenerateProxiesCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of the Kdyby (http://www.kdyby.org)
5
 *
6
 * Copyright (c) 2008 Filip Procházka ([email protected])
7
 *
8
 * For the full copyright and license information, please view the file license.txt that was distributed with this source code.
9
 */
10
11
namespace Kdyby\Doctrine\Console;
12
13
use Doctrine;
14
use Symfony\Component\Console\Input\InputInterface;
15
use Symfony\Component\Console\Input\InputOption;
16
use Symfony\Component\Console\Output\OutputInterface;
17
18
19
20
/**
21
 * @author Filip Procházka <[email protected]>
22
 */
23
class GenerateProxiesCommand extends Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand
24
{
25
26
	/**
27
	 * @var \Kdyby\Doctrine\Tools\CacheCleaner
28
	 * @inject
29
	 */
30
	public $cacheCleaner;
31
32
33
34
	public function __construct()
35
	{
36
		parent::__construct();
37
	}
38
39
40
41
	/**
42
	 * {@inheritDoc}
43
	 */
44
	protected function configure()
45
	{
46
		parent::configure();
47
		$this->addOption('em', NULL, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
48
	}
49
50
51
52
	protected function initialize(InputInterface $input, OutputInterface $output)
53
	{
54
		parent::initialize($input, $output);
55
56
		if ($input->getOption('em')) {
57
			CommandHelper::setApplicationEntityManager($this->getHelper('container'), $input->getOption('em'));
58
		}
59
60
		$this->cacheCleaner->invalidate();
61
	}
62
63
}
64