Search code examples
phpsymfonysonata-adminsonata

Sonata block http cache handler sonata.cache.noop not defined


I'm trying to set up sonata block cache but when I setup the http_cache handler I'm getting an exception even when the service seems to be there.

My current test setup is the following

sonata_cache:
    caches:
        predis:
            servers:
                - {host: %redis_host%, port: %redis_port%, database: 2}
        apc:
            token:  %secret%   # token used to clear the related cache
            prefix: %domain%     # prefix to ensure there is no clash between instances
#            servers:
#                - { domain: %domain%, ip: 127.0.0.1, port: 80 }
            timeout:
                RCV: { sec: 5, usec: 0 }
                SND: { sec: 5, usec: 0 }

sonata_block:
    http_cache:
#        handler: sonata.cache.noop
        listener: true

I can see the multiple services that I enabled on the sonata_cache.caches

$ app/console debug:container sonata.cache.noop
[container] Information for service sonata.cache.noop
Service Id       sonata.cache.noop
Class            Sonata\Cache\Adapter\Cache\NoopCache
Tags
    - sonata.cache                   ()
[...]

If I change the sonata_block setup to:

sonata_block:
    http_cache:
        handler: sonata.cache.noop
        listener: true

I got the following exception

InvalidArgumentException in ContainerBuilder.php line 796 "The service definition "sonata.cache.noop" does not exist."

Does anyone had a similar issue?


Solution

  • Try to replace :

    handler: sonata.cache.noop
    

    to :

    handler: sonata.block.cache.handler.noop