How to set doctrine file_system directory and namespace in symfony?

How to set doctrine file_system directory and namespace in symfony?
I tried:

doctrine:
    orm:
        entity_managers:
            default:
               metadata_cache_driver: 
                                      type: file_system
                                      cache_namespace: blah
                                      cache_dir: %kernel.root_dir%/cache/doctrine

and also

            metadata_cache_driver: 
                                  type: file_system
                                  cache_namespace: blah
                                  directory: %kernel.root_dir%/cache/doctrine

and also

                                 dir: %kernel.root_dir%/cache/doctrine

But it seems all of them are wrong. please advice.

Where did you get “file_system” from?

Doctrine offers Filesystem cache too. I looked at source code of doctrine-cache-bundle of my vendor and see its systax here is file_system, it has “directory” element too. But how to define it in config.yml? Please see the source code of that bundle.

Or better yet, read the documentation. In particular, make sure you did all the installation steps.

1 Like

That way seems to be for general use of cache system. I want to use cache for metadata and query, to do so I think I should go with the way you gave the link in your earlier reply on symfony site. As you see in your latter link there is file_system too, but I get error for “directory” element. How should I use it?

Even following the way on github:

doctrine_cache:
    providers:
        my_metadata_cache:
            type: file_system
            directory: "%kernel.root_dir%/cache/doctrine"
        my_query_cache:
            file_system: ~

I get error:

[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
Unrecognized options “directory” under “doctrine_cache.providers.my_metadat
a_cache”

Please advice.

Start by double checking that you’re loading the doctrine cache bundle in your app kernel.

I did that! Still the problem:
https://github.com/doctrine/DoctrineCacheBundle/issues/38

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.