1 | <?php |
||
22 | class Application extends BaseApplication |
||
|
|||
23 | { |
||
24 | private $kernel; |
||
25 | private $commandsRegistered = false; |
||
26 | |||
27 | /** |
||
28 | * Constructor. |
||
29 | * |
||
30 | * @param KernelInterface $kernel A KernelInterface instance |
||
31 | */ |
||
32 | public function __construct(KernelInterface $kernel) |
||
41 | |||
42 | /** |
||
43 | * Gets the Kernel associated with this Console. |
||
44 | * |
||
45 | * @return KernelInterface A KernelInterface instance |
||
46 | */ |
||
47 | public function getKernel() |
||
51 | |||
52 | /** |
||
53 | * Runs the current application. |
||
54 | * |
||
55 | * @param InputInterface $input An Input instance |
||
56 | * @param OutputInterface $output An Output instance |
||
57 | * |
||
58 | * @return int 0 if everything went fine, or an error code |
||
59 | */ |
||
60 | public function doRun(InputInterface $input, OutputInterface $output) |
||
76 | |||
77 | /** |
||
78 | * {@inheritdoc} |
||
79 | */ |
||
80 | public function find($name) |
||
86 | |||
87 | /** |
||
88 | * {@inheritdoc} |
||
89 | */ |
||
90 | public function get($name) |
||
91 | { |
||
92 | $this->registerCommands(); |
||
93 | |||
94 | return parent::get($name); |
||
95 | } |
||
96 | |||
97 | /** |
||
98 | * {@inheritdoc} |
||
99 | */ |
||
100 | public function all($namespace = null) |
||
106 | |||
107 | /** |
||
108 | * {@inheritdoc} |
||
109 | */ |
||
110 | public function getLongVersion() |
||
114 | |||
115 | public function add(Command $command) |
||
116 | { |
||
117 | $this->registerCommands(); |
||
118 | |||
119 | $name = $command->getName(); |
||
120 | if (substr($name, 0, 12) === 'translation:') { |
||
121 | $command->setName(substr($name, 12)); |
||
122 | } |
||
123 | |||
124 | return parent::add($command); |
||
125 | } |
||
126 | |||
127 | protected function registerCommands() |
||
151 | } |
||
152 |
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.