/** * @param ConsoleCommandEvent $event */ public function onConsoleCommand(ConsoleCommandEvent $event) { $command = $event->getCommand(); if ($command instanceof HelpCommand) { $command = $this->getCommandFromHelpCommand($command, $event->getInput()); } if (!$command instanceof FormBasedCommand) { return; } $inputDefinition = $this->inputDefinitionFactory->createForFormType($command->formType()); $this->setInputDefinition($command, $event->getInput(), $inputDefinition); }
/** * @param string|\Symfony\Component\Form\FormTypeInterface $formType * @param ConfigCache $cache * @param array &$resources * * @return \Symfony\Component\Console\Input\InputDefinition */ private function freshInputDefinition($formType, ConfigCache $cache, array &$resources) { $inputDefinition = $this->inputDefinitionFactory->createForFormType($formType, $resources); $cache->write(serialize($inputDefinition), $resources); return $inputDefinition; }