php - symfony2.1 FOQElasticaBundle 类加载

标签 php elasticsearch symfony-2.1 elastica

我按照 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 的类。

问题是

  • 与当前的 Elastica 库相比,FOQElasticaBundle 是否已过时?
  • 还是我的自动加载出了什么问题。 ps:我正在使用 Composer 自动加载器?

  • 应用程序/自动加载.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/

    相关文章:

    php - symfony 2 中的结构应用

    symfony - 无法在产品中找到模板

    php - 计算与平均值的百分比差异

    php - 在分类页面上显示标签

    php - Elasticsearch 5.5使用CURL获取错误 'not_x_content_exception'

    elasticsearch - bucket_selector中的_bucket_count-管道聚合

    php - 媒体查询在 MediaWiki 中有效吗?

    php - 如何终止 laravel 迁移中的数据丢失

    elasticsearch - 涉及嵌套模型的复杂轮胎查询

    symfony - Symfony2 中的通用注释系统