When trying to do a simple search method with Algolia. The search method will query Algolia to get matching results and then will create a doctrine collection. I get this error:
I injected my indexManager in my controller :
class ProductController extends Controller
{
protected $indexManager;
public function __construct(IndexManagerInterface $indexingManager)
{
$this->indexManager = $indexingManager;
}
public function displayAction(Request $request) {
$em = $this->getDoctrine()->getManagerForClass(Product::class);
$posts = $this->indexManager->search('query', Product::class, $em);
return $this->render('ProductBundle:Default:postDisplay.html.twig', array(
'posts' => $posts));
}
}
Can you make sure the autowire
feature is set to true
?
https://symfony.com/doc/current/service_container/autowiring.html
Symfony should resolve the dependency automatically.