Skip to content

Commit

Permalink
Remove usage of container in favour of injecting the variable directly
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Jossart committed Jan 24, 2019
1 parent d2b2e08 commit 4f2a696
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 38 deletions.
20 changes: 9 additions & 11 deletions src/Kunstmaan/GeneratorBundle/Command/InstallCommand.php
Expand Up @@ -29,17 +29,15 @@ class InstallCommand extends Command
*/
private $commandSteps = 0;

/**
* @var ContainerInterface
*/
private $containter;
/** @var string */
private $rootDir;

/**
* @param ContainerInterface $container Container
* @param string $rootDir
*/
public function __construct(ContainerInterface $container)
public function __construct(string $rootDir)
{
$this->container = $container;
$this->rootDir = $rootDir;

parent::__construct();
}
Expand Down Expand Up @@ -89,7 +87,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$input->setOption('demosite', $demositeOption);
$input->setOption('bundle-name', strtr($namespace, ['\\Bundle\\' => '', '\\' => '']));

$dir = $input->getOption('dir') ?: dirname($this->container->getParameter('kernel.root_dir')) . '/src';
$dir = $input->getOption('dir') ?: dirname($this->rootDir) . '/src';
$input->setOption('dir', $dir);

$output->writeln('<info>Installation start</info>');
Expand All @@ -98,9 +96,9 @@ protected function interact(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output)
{
$demositeOptions = ['--namespace' => $input->getOption('namespace')];
$demositeOptions = $input->getOption('demosite') === 'Yes'
? ['--demosite' => true]
: [];
if($input->getOption('demosite') === 'Yes') {
$demositeOptions['--demosite'] = true;
}

$this
->executeCommand($output,'kuma:generate:bundle', [
Expand Down

This file was deleted.

Expand Up @@ -14,8 +14,6 @@ class KunstmaanGeneratorExtension extends Extension
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$this->processConfiguration($configuration, $configs);
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
}
Expand Down

0 comments on commit 4f2a696

Please sign in to comment.