Sulu\Bundle\GeneratorBundle\Command\GenerateBundleCommand::updateKernel PHP Method

updateKernel() protected method

protected updateKernel ( DialogHelper $dialog, Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output, Symfony\Component\HttpKernel\KernelInterface $kernel, $namespace, $bundle )
$dialog Sulu\Bundle\GeneratorBundle\Command\Helper\DialogHelper
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
$kernel Symfony\Component\HttpKernel\KernelInterface
    protected function updateKernel(DialogHelper $dialog, InputInterface $input, OutputInterface $output, KernelInterface $kernel, $namespace, $bundle)
    {
        $auto = true;
        if ($input->isInteractive()) {
            $auto = $dialog->askConfirmation($output, $dialog->getQuestion('Confirm automatic update of your Kernel', 'yes', '?'), true);
        }
        $output->write('Enabling the bundle inside the Kernel: ');
        $manip = new KernelManipulator($kernel);
        try {
            $ret = $auto ? $manip->addBundle($namespace . '\\' . $bundle) : false;
            if (!$ret) {
                $reflected = new \ReflectionObject($kernel);
                return [sprintf('- Edit <comment>%s</comment>', $reflected->getFilename()), '  and add the following bundle in the <comment>AppKernel::registerBundles()</comment> method:', '', sprintf('    <comment>new %s(),</comment>', $namespace . '\\' . $bundle), ''];
            }
        } catch (\RuntimeException $e) {
            return [sprintf('Bundle <comment>%s</comment> is already defined in <comment>AppKernel::registerBundles()</comment>.', $namespace . '\\' . $bundle), ''];
        }
    }