<h3 dir="auto">The problem</h3>
<p dir="auto">Although they are not commonly used, SecurityBundle provides some useful functions called <code class="notranslate">logout_path()</code> and <code class="notranslate">logout_url()</code> (<a href="http://symfony.com/doc/current/reference/twig_reference.html#logout-path" rel="nofollow">see reference</a>).</p>
<p dir="auto">In regular Symfony applications I don't use them because I always know exactly the URL or the route name associated with the logout action. However, when developing some code that can be integrated in any Symfony application I can no longer know the logout URL and I must use <code class="notranslate">logout_*()</code> functions.</p>
<p dir="auto">The problem is that these functions, obviously, require the name of the user provider to generate the URL. But again, I cannot know the name of the user provider for the Symfony application which is going to use this software.</p>
<h3 dir="auto">The solution</h3>
<p dir="auto">The current solution seems verbose and a bit weird to me:</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;a href=&quot;{{ logout_path(app.security.token.providerKey) }}&quot;&gt;Close session&lt;/a&gt;"><pre class="notranslate">&lt;a href="<span class="pl-s">{{ logout_path(app.security.token.providerKey) }}</span>"&gt;<span class="pl-v">Close</span> session&lt;/a&gt;</pre></div>
<p dir="auto">What do you think about making this argument optional? If you set it, the URL is generated for that provider. If you don't set the argument, the function automatically selects the right provider for the current user:</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;a href=&quot;{{ logout_path() }}&quot;&gt;Close session&lt;/a&gt;"><pre class="notranslate">&lt;a href="<span class="pl-s">{{ logout_path() }}</span>"&gt;<span class="pl-v">Close</span> session&lt;/a&gt;</pre></div>
<p dir="auto">Hi,</p>
<p dir="auto">I am trying to use the new <a href="http://symfony.com/blog/new-in-symfony-2-8-service-auto-wiring" rel="nofollow">auto wiring feature</a> to automatically load the entity manager to my service:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="my_test_service.test:
      class: MyTestBundle\Service\TestService
      autowire: true"><pre class="notranslate"><span class="pl-ent">my_test_service.test</span>:
      <span class="pl-ent">class</span>: <span class="pl-s">MyTestBundle\Service\TestService</span>
      <span class="pl-ent">autowire</span>: <span class="pl-c1">true</span></pre></div>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="use Doctrine\ORM\EntityManager;
class TestService
{
    public function __construct(EntityManager $em)
    {
    }
}"><pre class="notranslate"><span class="pl-k">use</span> <span class="pl-v">Doctrine</span>\<span class="pl-c1">ORM</span>\<span class="pl-v">EntityManager</span>;
<span class="pl-k">class</span> <span class="pl-v">TestService</span>
{
    <span class="pl-k">public</span> <span class="pl-k">function</span> <span class="pl-en">__construct</span>(<span class="pl-smi"><span class="pl-smi">EntityManager</span></span> <span class="pl-s1"><span class="pl-c1">$</span>em</span>)
    {
    }
}</pre></div>
<p dir="auto">Result is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="RuntimeException in AutowirePass.php line 231: Unable to autowire argument
of type &quot;Doctrine\ORM\EntityManager&quot; for the service &quot;my_test_service.test&quot;."><pre class="notranslate"><code class="notranslate">RuntimeException in AutowirePass.php line 231: Unable to autowire argument
of type "Doctrine\ORM\EntityManager" for the service "my_test_service.test".
</code></pre></div>
<p dir="auto">Any idea?</p>
<p dir="auto">Thanks</p>
<p dir="auto">Seb</p>