Question

I'm using Elastica search engine for my Symfony project.

Now, I'm getting the below error :

The autoloader expected class "Elastica_Query_Bool" to be defined in file "/blablabla/vendor/ruflin/elastica/lib/Elastica/Query/Bool.php". The file was found but the class was not in it, the class name or namespace probably has a typo.

If I change new \Elastica_Query_Bool() for new \Elastica\Query\Bool() in my php file, it works fine.

But I can't understand why I'm getting an error now. Any idea ?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top