gpt4 book ai didi

找不到php Symfony2 redis类

转载 作者:可可西里 更新时间:2023-11-01 10:59:16 25 4
gpt4 key购买 nike

我正在将 Redis 集成到我的 symfony2 中。我用过这个图:

http://olegpuzanov.com/2015/02/01/using-redis-for-doctrine-caching-in-symfony2/

appDevDebugProjectContainer.php 第 966 行中的 ClassNotFoundException:尝试从全局命名空间加载类“Redis”。您是否忘记了“使用”语句?

这是我的配置:

snc_redis:
# configure predis as client
clients:
default:
type: predis
alias: default
dsn: redis://localhost
doctrine:
type: predis
alias: doctrine
dsn: redis://localhost
# configure doctrine caching
doctrine:
metadata_cache:
client: doctrine
entity_manager: Content
document_manager: default
result_cache:
client: doctrine
entity_manager: [Content]
query_cache:
client: doctrine
entity_manager: Content

和我的查询:

       $query  = $this->createQueryBuilder('c')
->select('c.id, c.title, c.sequence, c.sequence_count, c.category_sequence, c.unique_id, c.priority, c.status, c.created_at,c.kaltura_id')
->addSelect('o.slug as owner')
->addSelect('cat.slug as category')
->addSelect("group_concat(m.name SEPARATOR ',') AS media")
->addSelect("group_concat(a.name SEPARATOR ',') AS album")
->innerJoin('c.content_owner', 'o')
->innerJoin('c.category', 'cat')
->leftJoin('c.media', 'm')
->leftJoin('c.albums', 'a')
->groupBy('c.id')
->setResultCacheDriver($predis)
# set cache lifetime
->setResultCacheLifetime($cache_lifetime)

->getQuery()
->getArrayResult();`

我还在我的应用程序内核中注册了 snc 包。

请帮忙

最佳答案

git clone https://github.com/phpredis/phpredis.git
cd phpredis
git checkout php7
phpize
./configure
make && make install
cd ..
rm -rf phpredis

参见 https://gist.github.com/hollodotme/418e9b7c6ebc358e7fda

关于找不到php Symfony2 redis类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31959160/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com