From acc66b9d72f61803ec5ff4f156768e86b3962ef8 Mon Sep 17 00:00:00 2001 From: pmartelletti Date: Fri, 18 Oct 2013 15:18:27 -0300 Subject: [PATCH] [FrameworkBundle] Add posibility to specify method and host in router:match command --- .../FrameworkBundle/Command/RouterMatchCommand.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php index 591ccb734999..bb2db9c19cb6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php @@ -13,6 +13,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Routing\RouterInterface; @@ -50,12 +51,16 @@ protected function configure() ->setName('router:match') ->setDefinition(array( new InputArgument('path_info', InputArgument::REQUIRED, 'A path info'), + new InputOption('method', null, InputOption::VALUE_REQUIRED, 'Sets the HTTP method', 'GET'), + new InputOption('host', null, InputOption::VALUE_REQUIRED, 'Sets the HTTP host', 'localhost'), )) ->setDescription('Helps debug routes by simulating a path info match') ->setHelp(<<%command.name% simulates a path info match: php %command.full_name% /foo + or + php %command.full_name% /foo --method POST --host symfony.com EOF ) @@ -68,7 +73,11 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { $router = $this->getContainer()->get('router'); - $matcher = new TraceableUrlMatcher($router->getRouteCollection(), $router->getContext()); + $context = $router->getContext(); + $context->setMethod($input->getOption('method')); + $context->setHost($input->getOption('host')); + + $matcher = new TraceableUrlMatcher($router->getRouteCollection(), $context); $traces = $matcher->getTraces($input->getArgument('path_info')); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy