예제 #1
0
 /**
  * @param OutputInterface $output
  * @param string          $action
  * @param string[]        $requestType
  */
 protected function dumpProcessors(OutputInterface $output, $action, array $requestType)
 {
     $output->writeln('The processors are displayed in order they are executed.');
     /** @var ProcessorBagInterface $processorBag */
     $processorBag = $this->getContainer()->get('oro_api.processor_bag');
     $table = new Table($output);
     $table->setHeaders(['Processor', 'Attributes']);
     $context = new Context();
     $context->setAction($action);
     if (!empty($requestType)) {
         $context->set('requestType', $requestType);
     }
     $processors = $processorBag->getProcessors($context);
     $applicableChecker = new ChainApplicableChecker();
     $applicableChecker->addChecker(new RequestTypeApplicableChecker());
     $processors->setApplicableChecker($applicableChecker);
     $i = 0;
     foreach ($processors as $processor) {
         if ($i > 0) {
             $table->addRow(new TableSeparator());
         }
         $processorColumn = sprintf('<comment>%s</comment>%s%s', $processors->getProcessorId(), PHP_EOL, get_class($processor));
         $processorDescription = $this->getClassDocComment(get_class($processor));
         if (!empty($processorDescription)) {
             $processorColumn .= PHP_EOL . $processorDescription;
         }
         $attributesColumn = $this->formatProcessorAttributes($processors->getProcessorAttributes());
         $table->addRow([$processorColumn, $attributesColumn]);
         $i++;
     }
     $table->render();
 }
 /**
  * @return ChainApplicableChecker
  */
 protected function getApplicableChecker()
 {
     $checker = new ChainApplicableChecker();
     $checker->addChecker(new SkipGroupApplicableChecker());
     return $checker;
 }