title: Argument 1 passed to DoctrineDataCollector::__construct() must be an instance of Doctrine\Common\Persistence\ManagerRegistry
body: <p>I am developing a Symfony project which somebody else started on and I was happy that I had it up and running. Unfortunatelly after running <code>composer update</code> today, the Symfony page that I have throws an error.</p>
  <p>After running composer update the following error was displayed:</p>
  <blockquote>
  <p>Composer update error</p>
  </blockquote>
  <pre><code>Executing script cache:clear [KO]
   [KO]
  Script cache:clear returned with error code 255
  !!  Symfony\Component\ErrorHandler\Error\ClassNotFoundError {#132
  !!    #message: &quot;&quot;&quot;
  !!      Attempted to load class &quot;MappingDriverChain&quot; from namespace &quot;Doctrine\Common\Persistence\Mapping\Driver&quot;.\n
  !!      Did you forget a &quot;use&quot; statement for &quot;Doctrine\Persistence\Mapping\Driver\MappingDriverChain&quot;?
  !!      &quot;&quot;&quot;
  !!    #code: 0
  !!    #file: &quot;./var/cache/dev/ContainerFcUQG2T/App_KernelDevDebugContainer.php&quot;
  !!    #line: 869
  !!    trace: {
  !!      ./var/cache/dev/ContainerFcUQG2T/App_KernelDevDebugContainer.php:869 {
  !!        ContainerFcUQG2T\App_KernelDevDebugContainer-&gt;getDoctrine_Orm_DefaultEntityManagerService($lazyLoad = true)
  !!        ›
  !!        › $b = new \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain();
  !!        › $b-&gt;addDriver(new \Doctrine\ORM\Mapping\Driver\AnnotationDriver(($this-&gt;privates['annotations.cached_reader'] ?? $this-&gt;getAnnotations_CachedReaderService()), [0 =&gt; (\dirname(__DIR__, 4).'/src/Entity')]), 'App\\Entity');
  !!      }
  !!      ./var/cache/dev/ContainerFcUQG2T/App_KernelDevDebugContainer.php:5160 { …}
  !!      ./var/cache/dev/ContainerFcUQG2T/App_KernelDevDebugContainer.php:5204 { …}
  !!      ./var/cache/dev/ContainerFcUQG2T/App_KernelDevDebugContainer.php:569 { …}
  !!      ./vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php:87 { …}
  !!      ./vendor/symfony/http-kernel/Kernel.php:553 { …}
  !!      ./vendor/symfony/http-kernel/Kernel.php:126 { …}
  !!      ./vendor/symfony/framework-bundle/Console/Application.php:168 { …}
  !!      ./vendor/symfony/framework-bundle/Console/Application.php:74 { …}
  !!      ./vendor/symfony/console/Application.php:140 { …}
  !!      ./bin/console:42 { …}
  !!    }
  !!  }
  !!  2020-07-31T08:18:05+00:00 [critical] Uncaught Error: Class 'Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain' not found
  !!
  </code></pre>
  <p>After accessing the Symfony page, this TypeError was printed:</p>
  <p><strong>TypeError</strong></p>
  <blockquote>
  <p>Argument 1 passed to Doctrine\Bundle\DoctrineBundle\DataCollector\DoctrineDataCollector::__construct() must be an instance of Doctrine\Common\Persistence\ManagerRegistry, instance of Doctrine\Bundle\DoctrineBundle\Registry given, called in /var/www/html/mgo/var/cache/dev/ContainerFcUQG2T/App_KernelDevDebugContainer.php on line 1176</p>
  </blockquote>
  <p>To be honest I have no idea what caused this issue, but I think it has nothing to do with the changes I made in the <code>twig</code> and Symfony <code>php</code> files of the project.</p>
  <p>I'll add some files, if there is anything else that I should be looking into, let me know.</p>
  <blockquote>
  <p>/config/packages/doctrine.yaml</p>
  </blockquote>
  <pre><code>doctrine:
      dbal:
          url: '%env(resolve:DATABASE_URL)%'
  
          # IMPORTANT: You MUST configure your server version,
          # either here or in the DATABASE_URL env var (see .env file)
          #server_version: '5.7'
      orm:
          auto_generate_proxy_classes: true
          naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
          auto_mapping: true
          mappings:
              App:
                  is_bundle: false
                  type: annotation
                  dir: '%kernel.project_dir%/src/Entity'
                  prefix: 'App\Entity'
                  alias: App
  </code></pre>
  <blockquote>
  <p>composer.json</p>
  </blockquote>
  <pre><code>{
    &quot;name&quot;: &quot;project&quot;,
    &quot;description&quot;: &quot;project description&quot;,
    &quot;type&quot;: &quot;path&quot;,
    &quot;license&quot;: &quot;MIT&quot;,
    &quot;minimum-stability&quot;: &quot;dev&quot;,
    &quot;require&quot;: {
      &quot;php&quot;: &quot;^7.4&quot;,
      &quot;ext-ctype&quot;: &quot;*&quot;,
      &quot;ext-iconv&quot;: &quot;*&quot;,
      &quot;mgo/mgo-client-php&quot;: &quot;2.0.0&quot;,
      &quot;sensio/framework-extra-bundle&quot;: &quot;^5.1&quot;,
      &quot;symfony/asset&quot;: &quot;5.0.*&quot;,
      &quot;symfony/console&quot;: &quot;5.0.*&quot;,
      &quot;symfony/dotenv&quot;: &quot;5.0.*&quot;,
      &quot;symfony/expression-language&quot;: &quot;5.0.*&quot;,
      &quot;symfony/flex&quot;: &quot;^1.3.1&quot;,
      &quot;symfony/form&quot;: &quot;5.0.*&quot;,
      &quot;symfony/framework-bundle&quot;: &quot;5.0.*&quot;,
      &quot;symfony/http-client&quot;: &quot;5.0.*&quot;,
      &quot;symfony/intl&quot;: &quot;5.0.*&quot;,
      &quot;symfony/mailer&quot;: &quot;5.0.*&quot;,
      &quot;symfony/monolog-bundle&quot;: &quot;^3.1&quot;,
      &quot;symfony/notifier&quot;: &quot;5.0.*&quot;,
      &quot;symfony/orm-pack&quot;: &quot;*&quot;,
      &quot;symfony/process&quot;: &quot;5.0.*&quot;,
      &quot;symfony/security-bundle&quot;: &quot;5.0.*&quot;,
      &quot;symfony/serializer-pack&quot;: &quot;*&quot;,
      &quot;symfony/string&quot;: &quot;5.0.*&quot;,
      &quot;symfony/translation&quot;: &quot;5.0.*&quot;,
      &quot;symfony/twig-pack&quot;: &quot;*&quot;,
      &quot;symfony/validator&quot;: &quot;5.0.*&quot;,
      &quot;symfony/web-link&quot;: &quot;5.0.*&quot;,
      &quot;symfony/yaml&quot;: &quot;5.0.*&quot;,
      &quot;ext-json&quot;: &quot;*&quot;
    },
    &quot;repositories&quot;: [
        {
        &quot;type&quot;: &quot;path&quot;,
        &quot;url&quot;: &quot;/home/*user*/mgo-client-php&quot;,
        &quot;symlink&quot;: false
    }
    ],
    &quot;require-dev&quot;: {
        &quot;symfony/debug-pack&quot;: &quot;*&quot;,
        &quot;symfony/maker-bundle&quot;: &quot;^1.0&quot;,
        &quot;symfony/profiler-pack&quot;: &quot;*&quot;,
        &quot;symfony/test-pack&quot;: &quot;*&quot;,
        &quot;mgo-client-php&quot;: &quot;2.0.0&quot;,
        &quot;monolog/monolog&quot;: &quot;^1.23&quot;
    },
    &quot;config&quot;: {
        &quot;preferred-install&quot;: {
            &quot;*&quot;: &quot;dist&quot;
        },
        &quot;sort-packages&quot;: true
    },
    &quot;autoload&quot;: {
        &quot;psr-4&quot;: {
            &quot;App\\&quot;: &quot;src/&quot;
        }
    },
    &quot;autoload-dev&quot;: {
        &quot;psr-4&quot;: {
            &quot;App\\Tests\\&quot;: &quot;tests/&quot;
        }
    },
    &quot;replace&quot;: {
        &quot;paragonie/random_compat&quot;: &quot;2.*&quot;,
        &quot;symfony/polyfill-ctype&quot;: &quot;*&quot;,
        &quot;symfony/polyfill-iconv&quot;: &quot;*&quot;,
        &quot;symfony/polyfill-php72&quot;: &quot;*&quot;,
        &quot;symfony/polyfill-php71&quot;: &quot;*&quot;,
        &quot;symfony/polyfill-php70&quot;: &quot;*&quot;,
        &quot;symfony/polyfill-php56&quot;: &quot;*&quot;
    },
    &quot;scripts&quot;: {
        &quot;auto-scripts&quot;: {
            &quot;cache:clear&quot;: &quot;symfony-cmd&quot;,
            &quot;assets:install %PUBLIC_DIR%&quot;: &quot;symfony-cmd&quot;
        },
        &quot;post-install-cmd&quot;: [
            &quot;@auto-scripts&quot;
        ],
        &quot;post-update-cmd&quot;: [
            &quot;@auto-scripts&quot;
        ]
    },
    &quot;conflict&quot;: {
        &quot;symfony/symfony&quot;: &quot;*&quot;
    },
    &quot;extra&quot;: {
        &quot;symfony&quot;: {
            &quot;allow-contrib&quot;: false,
            &quot;require&quot;: &quot;5.0.*&quot;
        }
    }
  }
  </code></pre>
  <p>EDIT:</p>
  <p>As @Alexandre Tranchant suggested I removed my <code>/var/cache</code> file to get the original error. The error that pops up is the following:</p>
  <blockquote>
  <p>Attempted to load class &quot;MappingDriverChain&quot; from namespace &quot;Doctrine\Common\Persistence\Mapping\Driver&quot;.
  Did you forget a &quot;use&quot; statement for &quot;Doctrine\Persistence\Mapping\Driver\MappingDriverChain&quot;?</p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/UAkEc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UAkEc.png" alt="enter image description here" /></a></p>