Symfony2 Redis Validator,字符串而不是ClassMetadata
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Symfony2 Redis Validator,字符串而不是ClassMetadata相关的知识,希望对你有一定的参考价值。
我已经从Memcached迁移到了Redis。起初我使用的是PECL Redis 3.1.3,一切正常。更新到3.1.5后,我开始收到错误:
未捕获的php异常Symfony Component Debug Exception FatalThrowableError:“类型错误:传递给Symfony Component Validator Mapping Factory LazyLoadingMetadataFactory :: mergeConstraints()的参数1必须是Symfony Component Validator Mapping 的实例ClassMetadata,给定的字符串,在/ var / www / acme / www上的/var/www/acme/www/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php中调用/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: DoctrineCommonCacheRedisCache
validator.mapping.cache.redis:
class: SymfonyComponentValidatorMappingCacheDoctrineCache
arguments: ['@doctrine.cache.redis']
redis:
class: Redis
calls:
- [ connect, [ '%redis.ip%', '%redis.port%' ]]
doctrine.cache.redis:
class: DoctrineCommonCacheRedisCache
calls:
- [setRedis, ["@redis"]]
session.handler.redis:
class: SymfonyComponentHttpFoundationSessionStorageHandlerNativeSessionHandler
serializer.mapping.cache.memcached:
class: DoctrineCommonCacheMemcachedCache
doctrine_cache:
providers:
redis_cache:
redis:
connection_id: redis
我的symfony版本是2.8.31。有什么建议?
冲洗redis解决了问题..傻
redis-cli flushall
以上是关于Symfony2 Redis Validator,字符串而不是ClassMetadata的主要内容,如果未能解决你的问题,请参考以下文章
为Symfony2和Redis正名,基于PHP的10亿请求/周网站打造