0

Symfony プロジェクトに Elastica 検索エンジンを使用しています。

今、私は以下のエラーを取得しています:

オートローダーは、クラス「Elastica_Query_Bool」がファイル「/blablabla/vendor/ruflin/elastica/lib/Elastica/Query/Bool.php」で定義されることを予期していました。ファイルは見つかりましたが、その中にクラスがありませんでした。クラス名または名前空間にタイプミスがある可能性があります。

php ファイルでnew \Elastica_Query_Bool()forを変更すると、正常に動作します。new \Elastica\Query\Bool()

しかし、なぜ今エラーが発生しているのか理解できません。何か案が ?

4

1 に答える 1

1

Because when you new Elastica_Query_Bool it's looking for a class actually called Elastica_Query_Bool. And of course the actual class is called Bool.

try:

use Elastica\Query\Bool; // At the top of your file following the namespace line.
...
$bool = new Bool();

Might want to review namespaces in the php manual.

于 2013-08-17T23:08:28.730 に答える