Sulu\Bundle\GeneratorBundle\Command\GenerateBundleCommand::updateRouting PHP Метод

updateRouting() защищенный Метод

protected updateRouting ( DialogHelper $dialog, Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output, $bundle, $format = 'yml' )
$dialog Sulu\Bundle\GeneratorBundle\Command\Helper\DialogHelper
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function updateRouting(DialogHelper $dialog, InputInterface $input, OutputInterface $output, $bundle, $format = 'yml')
    {
        $auto = true;
        $this->route = '/';
        if ($input->isInteractive()) {
            $auto = $dialog->askConfirmation($output, $dialog->getQuestion('Confirm automatic update of the Routing', 'yes', '?'), true);
            if ($auto) {
                $this->route = $dialog->askAndValidate($output, 'Route prefix [length > 3]: ', function ($x) {
                    if (strlen($x) < 3) {
                        return false;
                    }
                    if ($x[0] != '/') {
                        $x = $x = '/' . $x;
                    }
                    return $x;
                });
            }
        }
        $output->write('Importing the bundle routing resource: ');
        $routing = new RoutingManipulator($this->getContainer()->getParameter('kernel.root_dir') . '/config/routing.yml');
        try {
            $ret = $auto ? $routing->addResource($bundle, $format, $this->route) : false;
            if (!$ret) {
                if ('annotation' === $format) {
                    $help = sprintf("        <comment>resource: \"@%s/Controller/\"</comment>\n        <comment>type:     annotation</comment>\n", $bundle);
                } else {
                    $help = sprintf("        <comment>resource: \"@%s/Resources/config/routing.%s\"</comment>\n", $bundle, $format);
                }
                $help .= "        <comment>prefix:   /</comment>\n";
                return ['- Import the bundle\'s routing resource in the app main routing file:', '', sprintf('    <comment>%s:</comment>', $bundle), $help, ''];
            }
        } catch (\RuntimeException $e) {
            return [sprintf('Bundle <comment>%s</comment> is already imported.', $bundle), ''];
        }
    }