Skip to content

[Doctrine][4.4] Documentation not clear about how to use "metadata_cache_driver" (May result in Unknown cache of type "array" configured for cache "metadata_cache" in entity manager "default".) #12788

Closed
@k00ni

Description

@k00ni

On the Doctrine configuration page (https://symfony.com/doc/4.4/reference/configuration/doctrine.html) it states to use the following configuration to setup Doctrine:

doctrine:
    orm:
        auto_mapping: true
        # the standard distribution overrides this to be true in debug, false otherwise
        auto_generate_proxy_classes: false
        proxy_namespace: Proxies
        proxy_dir: '%kernel.cache_dir%/doctrine/orm/Proxies'
        default_entity_manager: default
        metadata_cache_driver: array
        query_cache_driver: array
        result_cache_driver: array

But when using it, i get the following error:

Unknown cache of type "array" configured for cache "metadata_cache" in entity manager "default".

Here is my configuration:

doctrine:
    dbal:
        # configure these for your database server
        driver: 'pdo_mysql'
        server_version: '5.7'
        charset: utf8mb4
        default_table_options:
            charset: utf8mb4
            collate: utf8mb4_unicode_520_ci

        url: '%env(resolve:DATABASE_URL)%'
    orm:
        auto_mapping: true
        # the standard distribution overrides this to be true in debug, false otherwise
        auto_generate_proxy_classes: false
        naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
        metadata_cache_driver: array
        mappings:
            App:
                is_bundle: false
                type: annotation
                dir: '%kernel.project_dir%/src/App/Entity'
                prefix: 'App\Entity'
                alias: App

About my setup:

  • PHP 7.3
  • Symfony 4.4.1
  • Doctrine 2.7.0
  • Symfony ORM Pack 1.0.7

I also tried #10797, but it didn't help. Using metadata_cache_driver in doctrine.orm results in:

Symfony\Component\Config\Definition\Exception\InvalidConfigurationException: Unrecognized options "metadata_cache_driver, query_cache_driver, result_cache_driver" under "doctrine.orm". Available options are "auto_generate_proxy_classes", "default_entity_manager", "entity_managers", "proxy_dir", "proxy_namespace", "resolve_target_entities".


Did i missed something in the documentation?


EDIT: When running in dev environment, i had no problems, but after i started with PHPUnit tests requiring Doctrine, i ran into the error above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions