[英]symfony2.1 FOQElasticaBundle class load
I setup FOQElasticaBundle following this https://github.com/Exercise/FOQElasticaBundle#readme both Elastica and FOQElasticaBundle installed using git submodule. 我在此https://github.com/Exercise/FOQElasticaBundle#readme之后设置了FOQElasticaBundle,并使用git子模块安装了Elastica和FOQElasticaBundle。
and when I try app/console, it gives error 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.
并且当我尝试应用程序/控制台时,它给出错误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.
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.
I found that FOQ tried to load Elastica_Client class within vendor/elastica/lib/Elastica/Client.php and found nothing since the class named Client. 我发现FOQ试图在vendor / elastica / lib / Elastica / Client.php中加载Elastica_Client类,但自名为Client的类以来未发现任何内容。
I randomly browse elastica repo https://github.com/ruflin/Elastica/blob/v0.18.6.0/lib/Elastica/Client.php , and found that the class previously named Elastica_Client. 我随机浏览了elastica存储库https://github.com/ruflin/Elastica/blob/v0.18.6.0/lib/Elastica/Client.php ,发现该类以前名为Elastica_Client。
the questions are 问题是
app/autoload.php app / autoload.php
$loader->add('Elastica', __DIR__.'/../vendor/elastica/lib');
$loader->add('FOQ', __DIR__.'/../vendor/bundles');
That FOQElasticaBundle
install steps is for Symfony 2.0 FOQElasticaBundle
安装步骤适用于Symfony 2.0
In SF2.1 you have to install your bundles with composer, so just add this to your composer.json
file: 在SF2.1中,您必须使用composer安装软件包,因此只需将其添加到composer.json
文件即可:
"ruflin/elastica": "0.19.8"
here an example "ruflin/elastica": "0.19.8"
此处为 "ruflin/elastica": "0.19.8"
Then run this command: 然后运行以下命令:
composer update
And the last step is: 最后一步是:
composer dumpautoload
The last step generate the autoloads files for you 最后一步为您生成自动加载文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.