Inheritance: extends Manipulator
Example #1
0
 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), ''];
     }
 }