title: Cannot autowire service: Argument references class but no such service exists
body: <p>I'm upgrading a project from <strong>Symfony 3</strong> to <strong>Symfony 4</strong>
   (<a href="https://github.com/symfony/symfony/blob/master/UPGRADE-4.0.md" rel="noreferrer">https://github.com/symfony/symfony/blob/master/UPGRADE-4.0.md</a>) and I have many repository/services like this:</p>
  
  <pre><code>namespace App\Entity;
  
  use App\Entity\Activation;
  use Doctrine\ORM\EntityRepository;
  use Predis\Client;
  
  class ActivationRepository extends EntityRepository
  {
      // ...
  }
  </code></pre>
  
  <p>And when I try to run the project in the browser like this:</p>
  
  <pre><code>http://localhost:8000/login
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>(1/1) RuntimeException
  Cannot autowire service "App\Entity\ActivationRepository": 
  argument "$class" of method 
  "Doctrine\ORM\EntityRepository::__construct()" 
  references class "Doctrine\ORM\Mapping\ClassMetadata" 
  but no such service exists.
  </code></pre>
  
  <p>Does this mean you have to create a service for <strong>"Doctrine\ORM\Mapping\ClassMetadata"</strong> in your services.yaml file?</p>
  
  <p>Thanks to autowiring my new services.yaml file is fairly small compared to the old one, which had 2000+ lines.
  The new services.yaml just has several of these (so far):</p>
  
  <pre><code>App\:
      resource: '../src/*'
  
  # Controllers
  App\Controller\:
      resource: '../src/Controller'
      autowire: true
      public: true
      tags: ['controller.service_arguments']
  
  # Models
  App\Model\:
      resource: '../src/Model/'
      autowire: true
      public: true
  
  // etc
  </code></pre>
  
  <p>Question:
  Do you really need to add service definitions to services.yaml for third party vendor classes? And if so, can I get an example of how to do that please?
  Any advice from anyone who has already upgraded from <strong>Symfony 3</strong> to <strong>Symfony 4</strong> would be great.</p>
  
  <p>PHP 7.2.0-2+ubuntu16.04.1+deb.sury.org+2 (cli) (built: Dec  7 2017 20:14:31) ( NTS )
  Linux Mint 18, Apache2 Ubuntu.</p>
  
  <p><strong>EDIT / FYI:</strong></p>
  
  <p>This is the "Doctrine\ORM\EntityRepository::__construct()" which the ActivationRepository extends:</p>
  
  <pre><code>/**
       * Initializes a new &lt;tt&gt;EntityRepository&lt;/tt&gt;.
       *
       * @param EntityManager         $em    The EntityManager to use.
       * @param Mapping\ClassMetadata $class The class descriptor.
       */
      public function __construct(EntityManagerInterface $em, Mapping\ClassMetadata $class)
      {
          $this-&gt;_entityName = $class-&gt;name;
          $this-&gt;_em         = $em;
          $this-&gt;_class      = $class;
      }
  </code></pre>
  
  <p>which is located here:</p>
  
  <pre><code>/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php
  </code></pre>