I'm looking for a concrete example of implementing DI with Symfony controllers... https://symfony.com/doc/3.4/controller/service.html hasn't been much help.
Config
search_service:
class: Acme\MyBundle\Services\SearchService
search_controller:
class: Acme\MyBundle\Controller\SearchController
arguments: ['@search_service']
Controller
// Acme/MyBundle/Controllers/SearchController.php
class SearchController extends Controller
{
public function __construct(SearchService $searchService)
{
$this->searchService = $searchService;
}
}
Gives me:
Type error: Argument 1 passed to Acme\\MyBundle\\Controller\\SearchController::__construct() must be an instance of Acme\\MyBundle\\Services\\SearchService, none given
Any help appreciated :)