<table role="table">
<thead>
<tr>
<th>Q</th>
<th>A</th>
</tr>
</thead>
<tbody>
<tr>
<td>Bug report?</td>
<td>yes</td>
</tr>
<tr>
<td>Feature request?</td>
<td>no</td>
</tr>
<tr>
<td>BC Break report?</td>
<td>no</td>
</tr>
<tr>
<td>RFC?</td>
<td>no</td>
</tr>
<tr>
<td>Symfony version</td>
<td>4.0.0</td>
</tr>
</tbody>
</table>
<p dir="auto">Hi, sorry if the question looks silly but I am stucked for hours since the 4.0 version of Symfony.<br>
In my <code class="notranslate">AuthController</code> I am trying to redirect the user to the homepage by using <code class="notranslate">$this-&gt;redirectToRoute('home')</code> but I get the following error :  <br><br>
<code class="notranslate">The "router" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.</code></p>
<p dir="auto">with these details :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException:
The &quot;router&quot; service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.

  at vendor/symfony/dependency-injection/Container.php:252
  at Symfony\Component\DependencyInjection\Container-&gt;get('router')
     (vendor/symfony/framework-bundle/Controller/ControllerTrait.php:73)
  at Symfony\Bundle\FrameworkBundle\Controller\Controller-&gt;generateUrl('home', array())
     (vendor/symfony/framework-bundle/Controller/ControllerTrait.php:110)
  at Symfony\Bundle\FrameworkBundle\Controller\Controller-&gt;redirectToRoute('home')
     (src/Controller/AuthController.php:33)
  at App\Controller\AuthController-&gt;login()
  at call_user_func_array(array(object(AuthController), 'login'), array())
     (vendor/symfony/http-kernel/HttpKernel.php:151)
  at Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:66)
  at Symfony\Component\HttpKernel\HttpKernel-&gt;handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:190)
  at Symfony\Component\HttpKernel\Kernel-&gt;handle(object(Request))
     (public/index.php:30)"><pre class="notranslate"><code class="notranslate">
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException:
The "router" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.

  at vendor/symfony/dependency-injection/Container.php:252
  at Symfony\Component\DependencyInjection\Container-&gt;get('router')
     (vendor/symfony/framework-bundle/Controller/ControllerTrait.php:73)
  at Symfony\Bundle\FrameworkBundle\Controller\Controller-&gt;generateUrl('home', array())
     (vendor/symfony/framework-bundle/Controller/ControllerTrait.php:110)
  at Symfony\Bundle\FrameworkBundle\Controller\Controller-&gt;redirectToRoute('home')
     (src/Controller/AuthController.php:33)
  at App\Controller\AuthController-&gt;login()
  at call_user_func_array(array(object(AuthController), 'login'), array())
     (vendor/symfony/http-kernel/HttpKernel.php:151)
  at Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:66)
  at Symfony\Component\HttpKernel\HttpKernel-&gt;handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:190)
  at Symfony\Component\HttpKernel\Kernel-&gt;handle(object(Request))
     (public/index.php:30)
</code></pre></div>
<p dir="auto">I installed the framework extra bundle, and of course extended my class to <code class="notranslate">Controller</code>.</p>
<p dir="auto">It worked well before I upgraded to this new version.</p>
<p dir="auto">Any ideas please ? :(</p>
<p dir="auto">Thank you</p>
<table role="table">
<thead>
<tr>
<th>Q</th>
<th>A</th>
</tr>
</thead>
<tbody>
<tr>
<td>Bug report?</td>
<td>yes</td>
</tr>
<tr>
<td>Feature request?</td>
<td>no</td>
</tr>
<tr>
<td>BC Break report?</td>
<td>no</td>
</tr>
<tr>
<td>RFC?</td>
<td>yes/no</td>
</tr>
<tr>
<td>Symfony version</td>
<td>3.4</td>
</tr>
</tbody>
</table>
<p dir="auto">I got the following deprecation after updating to Symfony 3.4:</p>
<blockquote>
<p dir="auto">User Deprecated: The "router" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.</p>
</blockquote>
<p dir="auto">Error:</p>
<blockquote>
<p dir="auto">"exception" =&gt; ErrorException {<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1787430" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/2303" data-hovercard-type="issue" data-hovercard-url="/symfony/symfony/issues/2303/hovercard" href="https://github.com/symfony/symfony/issues/2303">#2303</a> ▼<br>
#message: "User Deprecated: The "router" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead."<br>
#code: 0<br>
#file: "vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php"<br>
#line: 275<br>
#severity: E_USER_DEPRECATED<br>
trace: {▼<br>
vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:275 {<g-emoji class="g-emoji" alias="arrow_forward" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/25b6.png">▶</g-emoji>}<br>
vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php:85 {<g-emoji class="g-emoji" alias="arrow_forward" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/25b6.png">▶</g-emoji>}<br>
src/AppBundle/Controller/Backend/DashboardController.php:16 {▼<br>
›     -&gt;setPageTitle('Dashboard')<br>
›     -&gt;addBreadcrumb('Dashboard', $this-&gt;generateUrl('backend.dashboard'), 'dashboard')<br>
› ;<br>
}<br>
AppBundle\Controller\Backend\DashboardController-&gt;indexAction() {}<br>
vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:153 {<g-emoji class="g-emoji" alias="arrow_forward" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/25b6.png">▶</g-emoji>}<br>
vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68 {▶}<br>
vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:202 {<g-emoji class="g-emoji" alias="arrow_forward" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/25b6.png">▶</g-emoji>}<br>
web/app_dev.php:33 {<g-emoji class="g-emoji" alias="arrow_forward" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/25b6.png">▶</g-emoji>}<br>
}<br>
}</p>
</blockquote>