From fb5e820a8e1856ba6f2ca8ed609f5b818e7d2111 Mon Sep 17 00:00:00 2001 From: Geert De Deckere Date: Mon, 20 Oct 2014 10:36:07 +0200 Subject: [PATCH 1/3] Compiled PHP for customized route matching --- book/routing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/routing.rst b/book/routing.rst index d8846f49633..37d36fe4ae6 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -833,7 +833,7 @@ variables that are passed into the expression: Behind the scenes, expressions are compiled down to raw PHP. Our example would generate the following PHP in the cache directory:: - if (rtrim($pathinfo, '/contact') === '' && ( + if (0 === strpos($pathinfo, '/contact') && ( in_array($context->getMethod(), array(0 => "GET", 1 => "HEAD")) && preg_match("/firefox/i", $request->headers->get("User-Agent")) )) { From 3d883123a7ad820c94e756d96ac32855fd0bac63 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 26 Oct 2014 14:52:09 +0100 Subject: [PATCH 2/3] Reverted fb5e82 --- book/routing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/routing.rst b/book/routing.rst index 37d36fe4ae6..e3300e27b1b 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -833,7 +833,7 @@ variables that are passed into the expression: Behind the scenes, expressions are compiled down to raw PHP. Our example would generate the following PHP in the cache directory:: - if (0 === strpos($pathinfo, '/contact') && ( + if ($pathinfo === '/contact' && ( in_array($context->getMethod(), array(0 => "GET", 1 => "HEAD")) && preg_match("/firefox/i", $request->headers->get("User-Agent")) )) { From 78c9293dbcbcea7dbc135a6559d5d559b992eca4 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 10 Oct 2016 10:36:05 +0200 Subject: [PATCH 3/3] Added an article about private console commands --- console/private_commands.rst | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 console/private_commands.rst diff --git a/console/private_commands.rst b/console/private_commands.rst new file mode 100644 index 00000000000..a534667ad44 --- /dev/null +++ b/console/private_commands.rst @@ -0,0 +1,34 @@ +Creating Private Console Commands +================================= + +Console commands are public by default, meaning that they are listed alongside +other commands when executing the console application script without arguments +or when using the ``list`` command. + +However, sometimes commands are not intended to be executed by end-users; for +example, commands for the legacy parts of the application, commands exclusively +executed through scheduled tasks, etc. + +In those cases, you can define the command as **private** setting the +``setPublic()`` method to ``false`` in the command configuration:: + + // src/AppBundle/Command/FooCommand.php + namespace AppBundle\Command; + + use Symfony\Component\Console\Command\Command; + + class FooCommand extends Command + { + protected function configure() + { + $this + ->setName('app:foo') + // ... + ->setPublic(false) + ; + } + } + +Private commands behave the same as public commands and they can be executed as +before, but they are no longer displayed in command listings, so end-users are +not aware of their existence.