php-tmdb / symfony

Symfony 4,5 and 6 Bundle for TMDB ( The Movie Database ) API. Provides easy access to the php-tmdb/api library.
MIT License
35 stars 27 forks source link

non-existent service "tmdb.cache_handler" #8

Closed lookbadgers closed 9 years ago

lookbadgers commented 9 years ago

Just upgrading from "wtfzdotnet/php-tmdb-api": ">=1.2.0" to the latest version "php-tmdb/symfony": "~2.0" and have an issue.

The service "tmdb.client" has a dependency on a non-existent service "tmdb.cache_handler".

If I comment out /php-tmdb/symfony/Resources/config/services.xml [32-34] it works

<!--            <call method="setCacheHandler">
                <argument type="service" id="tmdb.cache_handler" />
            </call>-->

This is my configuration:

tmdb_symfony:
    api_key: x
    options:
        cache:
            enabled: true
            path: "/tmp/php-tmdb-api"

        log:
            enabled: true
            path: "/tmp/php-tmdb-api.log"  

Great package by the way, thank you.

wtfzdotnet commented 9 years ago

Sorry for getting back this late I've been clogged up for a while, I think this has to do with the fact you missed an part of the documentation:

You are required to define a doctrine cache handler yourself that you will use for response caching:

doctrine_cache:
    providers:
        tmdb_cache:
            file_system:
                directory: %kernel.root_dir%/cache/tmdb

The cache provider tmdb_cache is configured as following:

tmdb_symfony:
    options:
        cache:
            enabled: true
            handler: tmdb_cache

I agree the code or documentation will need improvement, I will try to tackle this somewhere in the near future.

wtfzdotnet commented 9 years ago

Take a look at the https://github.com/doctrine/DoctrineCacheBundle

lookbadgers commented 9 years ago

Thank you that works now.

I think if you just mentioned in brief how to enable doctrine cache in your docs, it will be more fool proof.

composer require doctrine/doctrine-cache-bundle

// app/AppKernel.php
public function registerBundles()
{
    // ...
    $bundles[] = new \Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle();