title: Having a custom repository with DBAL connection in Symfony 2 / Doctrine 2?
body: <p>I'm trying to inject default DBAL connection into a custom repository associated with a entity so I can do some raw sql query.</p>
  
  <p>In services.mxl</p>
  
  <pre><code>&lt;service id="acme.repository.document" class="Acme\Bundle\Repository\DocumentRepository"&gt;
        &lt;argument type="service" id="doctrine.orm.entity_manager" /&gt;
        &lt;argument&gt;Acme\Bundle\Entity\Document&lt;/argument&gt;
        &lt;argument type="service" id="database_connection" /&gt;
  &lt;/service&gt;
  </code></pre>
  
  <p>In my repository class DocumentRepository.php</p>
  
  <pre><code>class DocumentRepository extends EntityRepository {
  
      protected $conn;
  
      public function __construct($em, $class, Connection $conn)
      {
          $this-&gt;conn = $conn;
           parent::__construct($em,$class);
      }
  </code></pre>
  
  <p>But I get this error:</p>
  
  <blockquote>
    <p>Catchable Fatal Error: Argument 3 passed to
    Acme\Bundle\Repository\DocumentRepository::__construct() must be an
    instance of Doctrine\DBAL\Connection, none given, called in
    /project/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php on
    line 689 and defined in
    /project/src/Acme/Bundle/Repository/DocumentRepository.php line 18</p>
  </blockquote>
  
  <p>May you help me?</p>