Closed JanTvrdik closed 8 years ago
:+1: I also use Kdyby\Console\Application
directly. For links generation in commands it's better to use nextras/link-factory.
You should be able to do the thing that you're suggesting right now, it should work without any problems.
But, the dependency is there for two reasons...
1) simplicity - you install the extension run php www/index.php
and it just works™
2) "fixed" links generation
The second one is not relevant in Nette 2.3, so this could be refactored a bit. It also might be made optional.
it should work without any problems.
It does not work because ConsoleExtension
assumes that services such as application
do exist. The simple solution may be to use hasDefinition
before getDefinition
. Another example – this should work:
$loader = new ContainerLoader($tempDirectory, TRUE);
$className = $loader->load('', function (Compiler $compiler) {
$compiler->addExtension('console', new Kdyby\Console\DI\ConsoleExtension());
});
$dic = new $className;
$app = $dic->getByType(Kdyby\Console\Application::class);
$app->run();
But, the dependency is there for two reasons...
I understand why there is the dependency, but not why it is a required dependency. Optional dependency is fine.
I wasn't expecting you'd actually have a project with only few nette packages. I'm on board with that. Making it optional makes sense :)
:+1:
:+1:
I don't understand why does console need to depend on Nette\Application so I'd like to propose to relax this dependency.
To make it a bit clearer. I'd like to do this: