symfony: Error "It's a requirement to specify a Metadata Driver..." after Upgrade to 4.1.4

Symfony version(s) affected: 4.1.4

Description
After Upgrade from 4.1.3 to 4.1.4 i get the following error:

It’s a requirement to specify a Metadata Driver and pass it to Doctrine\ORM\Configuration::setMetadataDriverImpl().

EDIT: if you still have this issue, running composer require symfony/proxy-manager-bridge should fix it.

Trace: ``` in ORMException.php line 38 -- at ORMException::missingMappingDriverImpl()in EntityManager.php line 845 at EntityManager::create(object(Connection), object(Configuration))in srcDevDebugProjectContainer.php line 698 at srcDevDebugProjectContainer->getDoctrine_Orm_DefaultEntityManagerService()in Container.php line 242 at Container->make('doctrine.orm.default_entity_manager', 1)in Container.php line 222 at Container->get('doctrine.orm.default_entity_manager')in ManagerRegistry.php line 35 at ManagerRegistry->getService('doctrine.orm.default_entity_manager')in AbstractManagerRegistry.php line 200 at AbstractManagerRegistry->getManagers()in ProxyCacheWarmer.php line 49 at ProxyCacheWarmer->warmUp('E:\\www\\ltgsc\\var\\cache\\dev')in CacheWarmerAggregate.php line 57 at CacheWarmerAggregate->warmUp('E:\\www\\ltgsc\\var\\cache\\dev')in Kernel.php line 562 at Kernel->initializeContainer()in Kernel.php line 123 at Kernel->boot()in Kernel.php line 183 at Kernel->handle(object(Request))in index.php line 34 ```` To be updated: ``` composer outdated --direct friendsofphp/php-cs-fixer v2.12.2 v2.13.0 A tool to automatically fix PHP code style symfony/browser-kit v4.1.3 v4.1.4 Symfony BrowserKit Component symfony/console v4.1.3 v4.1.4 Symfony Console Component symfony/css-selector v4.1.3 v4.1.4 Symfony CssSelector Component symfony/debug-bundle v4.1.3 v4.1.4 Symfony DebugBundle symfony/dotenv v4.1.3 v4.1.4 Registers environment variables from a .env file symfony/expression-language v4.1.3 v4.1.4 Symfony ExpressionLanguage Component symfony/flex v1.0.89 v1.1.0 Composer plugin for Symfony symfony/form v4.1.3 v4.1.4 Symfony Form Component symfony/framework-bundle v4.1.3 v4.1.4 Symfony FrameworkBundle symfony/lock v4.1.3 v4.1.4 Symfony Lock Component symfony/maker-bundle v1.5.0 v1.6.0 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code. symfony/phpunit-bridge v4.1.3 v4.1.4 Symfony PHPUnit Bridge symfony/polyfill-apcu v1.8.0 v1.9.0 Symfony polyfill backporting apcu_* functions to lower PHP versions symfony/security-bundle v4.1.3 v4.1.4 Symfony SecurityBundle symfony/templating v4.1.3 v4.1.4 Symfony Templating Component symfony/translation v4.1.3 v4.1.4 Symfony Translation Component symfony/validator v4.1.3 v4.1.4 Symfony Validator Component symfony/var-dumper v4.1.3 v4.1.4 Symfony mechanism for exploring and dumping PHP variables symfony/web-server-bundle v4.1.3 v4.1.4 Symfony WebServerBundle symfony/yaml v4.1.3 v4.1.4 Symfony Yaml Component ``` Update: ``` composer update && composer dump-autoload --optimize Loading composer repositories with package information Updating dependencies (including require-dev)

Prefetching 41 packages

  • Downloading (100%)

Package operations: 1 install, 58 updates, 0 removals

  • Updating symfony/flex (v1.0.89 => v1.1.0): Loading from cache
  • Updating symfony/dotenv (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/cache (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/polyfill-apcu (v1.8.0 => v1.9.0): Loading from cache
  • Updating symfony/expression-language (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/polyfill-ctype (v1.8.0 => v1.9.0): Loading from cache
  • Updating symfony/inflector (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/property-access (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/polyfill-php70 (v1.8.0 => v1.9.0): Loading from cache
  • Updating symfony/polyfill-mbstring (v1.8.0 => v1.9.0): Loading from cache
  • Updating symfony/options-resolver (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/intl (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/polyfill-intl-icu (v1.8.0 => v1.9.0): Loading from cache
  • Updating symfony/event-dispatcher (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/form (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/lock (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/http-foundation (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/debug (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/http-kernel (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/routing (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/finder (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/filesystem (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/dependency-injection (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/config (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/framework-bundle (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/console (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/maker-bundle (v1.5.0 => v1.6.0): Loading from cache
  • Updating symfony/security (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/security-bundle (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/templating (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/translation (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/validator (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/yaml (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/stopwatch (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/process (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/polyfill-php72 (v1.8.0 => v1.9.0): Loading from cache
  • Updating composer/xdebug-handler (1.1.0 => 1.2.1): Loading from cache
  • Updating friendsofphp/php-cs-fixer (v2.12.2 => v2.13.0): Loading from cache
  • Updating symfony/dom-crawler (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/browser-kit (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/css-selector (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/var-dumper (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/twig-bridge (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/debug-bundle (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/phpunit-bridge (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/web-server-bundle (v4.1.3 => v4.1.4): Loading from cache
  • Updating doctrine/cache (v1.7.1 => v1.8.0): Loading from cache
  • Updating doctrine/persistence (v1.0.0 => v1.0.1): Loading from cache
  • Updating symfony/doctrine-bridge (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/twig-bundle (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/web-profiler-bundle (v4.1.3 => v4.1.4): Loading from cache
  • Updating symfony/serializer (v4.1.3 => v4.1.4): Loading from cache
  • Installing markbaker/complex (1.4.6): Loading from cache
  • Updating phpoffice/phpspreadsheet (1.3.1 => 1.4.0): Loading from cache
  • Updating egulias/email-validator (2.1.4 => 2.1.5): Loading from cache
  • Updating knplabs/knp-components (1.3.8 => v1.3.9): Loading from cache
  • Updating symfony/monolog-bridge (v4.1.3 => v4.1.4): Loading from cache
  • Updating zendframework/zend-code (3.3.0 => 3.3.1): Loading from cache
  • Updating ocramius/proxy-manager (2.2.0 => 2.2.1): Loading from cache

My Doctrine Config:

parameters: # Adds a fallback DATABASE_URL if the env var is not set. # This allows you to run cache:warmup even if your # environment variables are not available yet. # You should not need to change this value. env(DATABASE_URL): ‘’

doctrine: dbal: # configure these for your database server driver: ‘pdo_mysql’ server_version: ‘5.7’ charset: utf8

    # With Symfony 3.3, remove the `resolve:` prefix
    url: '%env(DATABASE_URL)%'
orm:
    auto_generate_proxy_classes: '%kernel.debug%'
    naming_strategy: doctrine.orm.naming_strategy.underscore
    auto_mapping: true
    mappings:
        XXXX:
            is_bundle: false
            type: annotation
            dir: '%kernel.project_dir%/src/Entity'
            prefix: 'XXXX\Entity'
            alias: XXXX

</details>

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 8
  • Comments: 63 (52 by maintainers)

Commits related to this issue

Most upvoted comments

I’m getting the same error with symfony 5.0.8. This error is mainly thrown if i use console commands. In the shutdown function of the doctrine bundle the entity Manager is injected as proxy.

If it than calls the clear method the error is thrown when the proxy is trying to instantiate the entityManager.

https://github.com/doctrine/DoctrineBundle/blob/f5a5a3dd1351818080b609b544608b472b07029f/DoctrineBundle.php#L107-115

The $this->container->get($id) returns a proxy. I’m using the proxy-manager-bridge.

Actual I’m decorating the EntityManager with my own factorymethod to prevent it from beeing lazy.

Is there any config option I’m missing or is this unwanted behaviour? Can’t reproduce it with a fresh system.

Done the updates step by step on this project and after doing this particular update the error occures:

composer update symfony/dependency-injection
Loading composer repositories with package information                                       Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
  - Updating symfony/dependency-injection (v4.1.3 => v4.1.4): Loading from cache

Seems one of these commits is causing this issue: https://github.com/symfony/dependency-injection/compare/v4.1.3...v4.1.4

I investigate further.

@nicolas-grekas Actually trying to build a reproducer the third time (seems i always stripped to much out at once so i can’t reproduce it).

I have several other services injected in my Entity Listeners Constructor and get the error “It’s a requirement to specify a Metadata Driver…” with “symfony/dependency-injection”: “~4.1.6@dev” but without proxy-manager-bridge.

    /**
     * EntityListener constructor.
     *
     * @param Mail                $mail
     * @param TranslatorInterface $translator
     * @param array               $config
     */
    public function __construct(Mail $mail, TranslatorInterface $translator, $config)
    {
        $this->mail = $mail;
        $this->translator = $translator;
        $this->config = $config;
    }

When i strip out theses services from my listeners constructor, the error goes away.

Will try to provide an reporducer next week.

It happens on a bigger closed source project, i am working on. I’m currently trying to figure out the cause by updating each package individually. I hope to be able to give more details soon.

I can confirm this issue after upgrading from Symfony 3.4.14 to 3.4.15.

This issue is driving me crazy 😃 I absolutely need a reproducer please.

Had the same issue on SF 4.1.4… Works for me too after upgrade to SF4.1.6.

I left some context from appLocalDebugProjectContainer at https://github.com/symfony/symfony/issues/28304#issuecomment-418521487.

Does composer require symfony/proxy-manager-bridge fix the issue?

I had exactly the same error while upgrading Symfony 3.4.13 to 3.4.15. When disabling doctrine tag “doctrine.orm.entity_listener” on the services that used it, there’s no more errors (not a solution but a diagnose). In my case cache:clear failed and the entire project is broken so i’m staying in 3.4.13.

Can one of you create a small example application that allows to reproduce?