-
Notifications
You must be signed in to change notification settings - Fork 33
Quick Start
Clémentine Urquizar - curqui edited this page Jan 27, 2022
·
6 revisions
The SearchService
is your entry point for any operation with the Meilisearch engine:
- Index data
- Search
- Clear data
Symfony 4 ships with a lighter container, where only core services are registered. If your controller will be responsible for search-related tasks, you can inject the SearchService
into the constructor by type-hinting the SearchService
interface. Symfony will take care of instantiating the right implementation for you.
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use MeiliSearch\Bundle\SearchService;
class ExampleController extends AbstractController
{
protected $searchService;
public function __construct(SearchService $searchService)
{
$this->searchService = $searchService;
}
}