Symfony2 Redis Validator,字符串而不是ClassMetadata

时间:2018-02-28 10:24:16

标签: php symfony caching redis doctrine

我已从Memcached迁移到Redis。起初我使用的是PECL Redis 3.1.3,一切正常。更新到3.1.5后,我开始收到错误:

  

未捕获的PHP异常   Symfony \ Component \ Debug \ Exception \ FatalThrowableError:"输入错误:   争论1传递给   Symfony的\分量\验证\制图\厂\ LazyLoadingMetadataFactory :: mergeConstraints()   必须是一个实例   Symfony \ Component \ Validator \ Mapping \ ClassMetadata,给定字符串,   呼唤   /var/www/acme/www/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php   在第95和34号线;在   /var/www/acme/www/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php   第120行

我已经查看并且redis更改日志,并且没有找到任何线索在两次版本更新后可能出现的问题。

我的config.yml(只有缓存/ redis内容):

framework:
    validation:
        cache: validator.mapping.cache.redis
    serializer:
        cache: serializer.mapping.cache.redis
    session:
        handler_id: session.handler.redis

doctrine:
    orm:
        auto_mapping: true
        metadata_cache_driver:
            type: redis
            host: "%redis.ip%"
            port: "%redis.port%"
            instance_class: Redis
            class: RedisCache
        query_cache_driver:
            type: redis
            host: "%redis.ip%"
            port: "%redis.port%"
            instance_class: Redis
            class: RedisCache
        result_cache_driver:
            type: redis
            host: "%redis.ip%"
            port: "%redis.port%"
            instance_class: Redis
            class: RedisCache

services:
    serializer.mapping.cache.redis:
        class: Doctrine\Common\Cache\RedisCache

    validator.mapping.cache.redis:
        class: Symfony\Component\Validator\Mapping\Cache\DoctrineCache
        arguments: ['@doctrine.cache.redis']

    redis:
        class: Redis
        calls:
            - [ connect, [ '%redis.ip%', '%redis.port%' ]]

    doctrine.cache.redis:
        class: Doctrine\Common\Cache\RedisCache
        calls:
            - [setRedis, ["@redis"]]

    session.handler.redis:
        class: Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler

    serializer.mapping.cache.memcached:
        class: Doctrine\Common\Cache\MemcachedCache


doctrine_cache:
    providers:
        redis_cache:
            redis:
                connection_id: redis

我的symfony版本是2.8.31。有什么建议吗?

1 个答案:

答案 0 :(得分:0)

冲洗redis解决了问题..傻乎乎的

redis-cli flushall