KnpLabs / ConsoleServiceProvider

A Console service provider for Silex
MIT License
107 stars 37 forks source link

Fix TwigBrige 3.4 break : The command defined in "Knp\Command\Twig\DebugCommand" cannot have an empty name. #41

Closed macintoshplus closed 6 years ago

macintoshplus commented 6 years ago

I have this error with TwigBridge 3.4:

(1/1) LogicException
    The command defined in "Knp\Command\Twig\DebugCommand" cannot have an empty name.
in Application.php (line 450)
at Application -> add( object( DebugCommand) ) in ConsoleServiceProvider.php (line   49)
at ConsoleServiceProvider -> Knp\Provider\{closure}( object( Application) ) in Container.php (line   118)
at Container -> offsetGet( 'console') in console (line   17)

The TwigBridge have changed in Symfony 3.4.

The command contructor parameters have changed. The name must be set by overwriting configure function and use "setName" function.

The default name as be addded info new static variable static::$defaultName in version 3.4.

For more compatibility, the name is set with hard writen value.

GregOriol commented 6 years ago

@macintoshplus A fix has just been pulled for this issue (commit 1d4cc12), and the solution there is actually a little bit better, have a look!

macintoshplus commented 6 years ago

Thanks for this good news!