From 306b29df5ed306da55eca35c3698ccc66ab98fd6 Mon Sep 17 00:00:00 2001 From: Tom Maaswinkel Date: Fri, 5 Jan 2018 11:35:33 +0100 Subject: [PATCH] Router service is now private The router service is private and not accessible in Symfony 4+, therefor $this->router should be used instead of $this->get('router'). Just above the example in question is explained how to get the router in your construct, so this should be clear. --- routing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routing.rst b/routing.rst index 99a510504e9..b1a14956458 100644 --- a/routing.rst +++ b/routing.rst @@ -576,7 +576,7 @@ Generating URLs with Query Strings The ``generate()`` method takes an array of wildcard values to generate the URI. But if you pass extra ones, they will be added to the URI as a query string:: - $this->get('router')->generate('blog', array( + $this->router->generate('blog', array( 'page' => 2, 'category' => 'Symfony' ));