1 | <?php |
||
21 | class Application extends BaseApplication |
||
|
|||
22 | { |
||
23 | private $kernel; |
||
24 | private $commandsRegistered = false; |
||
25 | |||
26 | /** |
||
27 | * Constructor. |
||
28 | * |
||
29 | * @param KernelInterface $kernel A KernelInterface instance |
||
30 | */ |
||
31 | public function __construct(KernelInterface $kernel) |
||
40 | |||
41 | /** |
||
42 | * Gets the Kernel associated with this Console. |
||
43 | * |
||
44 | * @return KernelInterface A KernelInterface instance |
||
45 | */ |
||
46 | public function getKernel() |
||
50 | |||
51 | /** |
||
52 | * Runs the current application. |
||
53 | * |
||
54 | * @param InputInterface $input An Input instance |
||
55 | * @param OutputInterface $output An Output instance |
||
56 | * |
||
57 | * @return int 0 if everything went fine, or an error code |
||
58 | */ |
||
59 | public function doRun(InputInterface $input, OutputInterface $output) |
||
75 | |||
76 | /** |
||
77 | * {@inheritdoc} |
||
78 | */ |
||
79 | public function find($name) |
||
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | public function get($name) |
||
90 | { |
||
91 | $this->registerCommands(); |
||
92 | |||
93 | return parent::get($name); |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * {@inheritdoc} |
||
98 | */ |
||
99 | public function all($namespace = null) |
||
105 | |||
106 | /** |
||
107 | * {@inheritdoc} |
||
108 | */ |
||
109 | public function getLongVersion() |
||
113 | |||
114 | public function add(Command $command) |
||
115 | { |
||
116 | $this->registerCommands(); |
||
117 | |||
118 | $name = $command->getName(); |
||
119 | if (substr($name, 0, 12) === 'translation:') { |
||
120 | $command->setName(substr($name, 12)); |
||
121 | } |
||
122 | |||
123 | return parent::add($command); |
||
124 | } |
||
125 | |||
126 | protected function registerCommands() |
||
150 | } |
||
151 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.