我按照 https://github.com/Exercise/FOQElasticaBundle#readme 设置了 FOQElasticaBundle
Elastica 和 FOQElasticaBundle 都使用 git 子模块安装。
当我尝试应用程序/控制台时,它会给出错误 The autoloader expected class "Elastica_Client" to be defined in file "/path/to/project/../vendor/elastica/lib/Elastica/Client.php". The file was found but the class was not in it, the class name or namespace probably has a typo.
我发现 FOQ 尝试在 vendor/elastica/lib/Elastica/Client.php 中加载 Elastica_Client 类,但自名为 Client 的类以来一无所获。
我随机浏览 elastica repo https://github.com/ruflin/Elastica/blob/v0.18.6.0/lib/Elastica/Client.php , 并发现
以前命名为 Elastica_Client 的类。
问题是
应用程序/自动加载.php
$loader->add('Elastica', __DIR__.'/../vendor/elastica/lib');
$loader->add('FOQ', __DIR__.'/../vendor/bundles');
最佳答案
那FOQElasticaBundle
安装步骤适用于 Symfony 2.0
在 SF2.1 中,您必须使用 composer 安装您的包,所以只需将其添加到您的 composer.json
文件:"ruflin/elastica": "0.19.8"
here an example
然后运行这个命令:composer update
最后一步是:composer dumpautoload
最后一步为您生成自动加载文件
关于php - symfony2.1 FOQElasticaBundle 类加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14455991/