Closed becygroup closed 4 years ago
Did you try this? Any service from extensions (defined in loadConfiguration()
) can be overriden in your config file.
services:
console.application:
factory: Your\Custom\Application
Btw, I am curious, why do you need to do that?
You are right, it works. I was confused by this in ConsoleExtension:
public function loadConfiguration(): void
{
// Skip if isn't CLI
if ($this->cliMode !== true) {
return;
}
and was looking for change Application class only for cliMode, so I deny my self change like you did. But your way is totally right :-)
I need to change help of application (not only command help) and Symfony/Console/Application
hasn't property/setter for that. So I need override method getHelp()
.
I'm closing this and thank you for your fast feedback :-)
I was confused by this in ConsoleExtension:
public function loadConfiguration(): void { // Skip if isn't CLI if ($this->cliMode !== true) { return; }
You should make console application service change in cli-only config
if (PHP_SAPI === 'cli') {
$configurator->addConfig(__DIR__ . '/config/console.neon');
}
I don't want to override whole extension only for changing the Application class.
Please, consider merge this. Thank you.