title: Symfony add doctrine to services.yml and custom extensions
body: <p>What I want achieve is call doctrine ini <code>TwigExtension</code>, I get some code from google and stackoverflow, like this :</p>
  
  <p>service.yml</p>
  
  <pre><code>twig.extension:
          class: AppBundle\Twig\AppExtension
          arguments:
              doctrine : '@doctrine'
          tags:
            -  { name: twig.extension }
  </code></pre>
  
  <p>AppBundle\Twig\AppEtension.php</p>
  
  <pre><code>&lt;?php
  
  namespace AppBundle\Twig;
  
  use Symfony\Bridge\Doctrine\RegistryInterface;
  
  class AppExtension extends \Twig_Extension
  {
      protected $doctrine;
  
      public function __construct(RegistryInterface $doctrine)
      {
          $this-&gt;doctrine = $doctrine;
      }
  
  }
  </code></pre>
  
  <p>I've followed all instruction from my source, but i still got error and cant call doctrine or do something with entitymanager here.</p>
  
  <p>this is my error :</p>
  
  <pre><code>Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]                                                                       
    Invalid key "doctrine" found in arguments of method "__construct()" for service "twig.extension": only integer or $named arguments are allowed.  
  </code></pre>
  
  <p>how to solve this?</p>