symfonydoctrine-ormsymfony4

Symfony 4.4 metadata_cache_driver configuration key deprecation notice


Since I've upgraded Symfony from 4.4.15 to 4.4.16 I've got following deprecation notice:

The "metadata_cache_driver" configuration key is deprecated. PHP Array cache is now automatically registered when %kernel.debug% is false.

This is strange as the official docs don't say anything about this deprecation except of this text:

Deprecated since version 4.4:All the Doctrine caching types are deprecated since Symfony 4.4 and won’t be available in Symfony 5.0 and higher. Replace them with either type: service or type: pool and use any of the cache pools/services defined with Symfony Cache.

But I'm using caching type pool or service. My configuration looks like this:

doctrine:  
    orm:  
        metadata_cache_driver:
            type: pool
            pool: doctrine.system_cache_pool  

framework:
    cache:
        default_memcached_provider: 'memcached://localhost:11211'
        pools:
            doctrine.system_cache_pool:
                adapter: cache.adapter.memcached
                public: false
                default_lifetime: 86400

I even tried to config the cache as a service like this which gives me the same deprecation notice:

doctrine:
    orm:    
        metadata_cache_driver:
            type: service
            id: doctrine.system_cache_provider

services:
    doctrine.system_cache_provider:
        class: Symfony\Component\Cache\DoctrineProvider
        public: false
        arguments:
            - '@doctrine.system_cache_pool'

framework:
    cache:
        default_memcached_provider: 'memcached://localhost:11211'
        pools:
            doctrine.system_cache_pool:
                adapter: cache.adapter.memcached
                public: false
                default_lifetime: 86400

Any ideas how to get rid of the deprecation notice?


Solution

  • Actually the deprecation was reverted: https://github.com/doctrine/DoctrineBundle/pull/1255

    So please make sure to keep the metadata_cache_driver config for your production environments when upgrading to DoctrineBundle 2.2.1.

    EDIT: The feature was released again with version 2.3.0 of DoctrineBundle. So the metadata_cache_driver config can safely be removed for prod environments when using this version.