/**
  * {@inheritdoc}
  */
 protected function writeError(OutputInterface $output, \Exception $error)
 {
     if ($output instanceof SymfonyStyle) {
         $output->newLine();
         $output->error($error->getMessage());
         return;
     }
     parent::writeError($output, $error);
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $name = $input->getArgument('name');
     if (empty($name)) {
         $output->comment('Provide the name of a bundle as the first argument of this command to dump its configuration.');
         $output->newLine();
         $this->listBundles($output);
         return;
     }
     $extension = $this->findExtension($name);
     $container = $this->compileContainer();
     $configs = $container->getExtensionConfig($extension->getAlias());
     $configuration = $extension->getConfiguration($configs, $container);
     $this->validateConfiguration($extension, $configuration);
     $configs = $container->getParameterBag()->resolveValue($configs);
     $processor = new Processor();
     $config = $processor->processConfiguration($configuration, $configs);
     if ($name === $extension->getAlias()) {
         $output->title(sprintf('Current configuration for extension with alias "%s"', $name));
     } else {
         $output->title(sprintf('Current configuration for "%s"', $name));
     }
     $output->writeln(Yaml::dump(array($extension->getAlias() => $config), 3));
 }
Example #3
0
 /**
  * Output execution status information to the console
  *
  * @param OutputInterface|StyleInterface $output
  * @param ConsoleTask $task
  * @param int $number The number of the task to be executed
  * @param int $total The total amount of tasks to be executed
  */
 protected function outputExecutionInfo($output, ConsoleTask $task, $number, $total)
 {
     $taskXofY = "Task ({$number}/{$total})";
     // Special formatting, if Symfony Style is provided
     if ($output instanceof StyleInterface) {
         $output->section($task->getName());
         $output->text($task->getDescription());
         $output->text($taskXofY);
         $output->newLine();
         return;
     }
     // Std. formatting
     $output->writeln($task->getName());
     $output->writeln('--------------------------------');
     $output->writeln($task->getDescription());
     $output->writeln($taskXofY);
     $output->writeln('');
 }