Open matak opened 8 years ago
You can use inject methods or @inject
properties
Perfect, thanks!
So.. solved? :)
maybe this tip in doc would be fine, somebody could appreciate this
Agreed
@fprochazka One more thing, If I want to run command with injects annotations in other command using procedure from Symfony documentation
$container = $this->getHelper('container')->getContainer();
$command = $container->getByType('Kdyby\Console\Application')
->find('pair:productsToFilters');
I need to run
$container->callInjects($command);
by hand, injects aren't called in find.
I also need to run this:
$arguments = [
'command' => 'pair:productsToFilters',
'--email' => $input->getOption('email'),
];
$pairProductsToFiltersInput = new ArrayInput($arguments);
$command->run($pairProductsToFiltersInput, $output);
It would be nice to have shorter in Kdyby\Console
for that. Something like:
$this->getHelper('command')
->find('pair:productsToFilters') // inject are already called in this stage
->run($arguments, $output);
@foxycode that is wrong, you should run other commands using the Console\Application
, just like Console\Tester\ApplicationTester
does it.
Nebyl by tady nějaký injecting? Toto DI není úplně ok ne? od doby co global context je fuj?