title: Config Symfony2 and Doctrine
body: <p>I am new to Symfony2 and Doctrine as well actually anyway. I am trying to config my Doctrine so i can use it in my Symfony2 project.</p>
  
  <p>I have created a DatabaseRepository file where I am doing my connection. When i execute this file i get an error: </p>
  
  <pre><code>Catchable fatal error: Argument 1 passed to DatabaseRepository::__construct() must be an instance of Doctrine\DBAL\Connection, none given, called in app/cache/dev/appDevDebugProjectContainer.php on line 2363
  </code></pre>
  
  <p>My DatabaseRepository file: </p>
  
  <pre><code>&lt;?php
  
  namespace Acme\DemoBundle\Doctrine;
  
  use Doctrine\DBAL\Connection;
  use Doctrine\DBAL\DBALException;
  use Psr\Log\LoggerInterface;
  
  class DatabaseRepository
  {
      /**
       * @var Connection
       */
      protected $db;
  
      /**
       * @var LoggerInterface
       */
      protected $logger;
  
      /**
       * @param Connection $connection
       * @param LoggerInterface $logger
       */
      public function __construct(
          Connection $connection,
          LoggerInterface $logger
      ) {
          $this-&gt;db = $connection;
          $this-&gt;logger = $logger;
      }
  }
  </code></pre>
  
  <p>doctrine sits under Vendor directory. I am using <code>use</code> to add the connection but this still will not work.</p>
  
  <p>OK guys sorry I think this question is incomplete I will all these.</p>
  
  <p>This is where I call my DatabaseRepository:</p>
  
  <p>
  
  <pre><code>namespace Acme\DemoBundle\Repository;
  
  use Acme\DemoBundle\Doctrine\DatabaseRepository;
  
  class TestRepo {
  
      public $doctrine;
  
      public function __construct(
          DatabaseRepository $databaseRepository
      ){
          $this-&gt;doctrine = $databaseRepository;
      }
  
  
      public function test()
      {
  
      }
  
  } 
  </code></pre>
  
  <p>And the Below are the services: </p>
  
  <pre><code>&lt;!-- Doctrine --&gt;
  &lt;service id="database_repository"
           class="Acme\DemoBundle\Doctrine\DatabaseRepository"&gt;
          &lt;argument type="service" id="Doctrine\DBAL\Connection" /&gt;
          &lt;argument type="service" id="Psr\Log\LoggerInterface" /&gt;
  &lt;/service&gt;
  
  &lt;service id="test_repo"
           class="Acme\DemoBundle\Repository\TestRepo"&gt;
      &lt;argument type="service" id="database_repository" /&gt;
  &lt;/service&gt;
  </code></pre>
  
  <p>As soogested in comments below I added arguments used to my database_repository service. </p>
  
  <p>But now I get this error:</p>
  
  <pre><code>Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException' with message 'The service "jdatabase_repository" has a dependency on a non-existent service "doctrine\dbal\connection"
  </code></pre>