Symfony - Cannot autowire argument $paginator - it references interface - but no such service exists
Hi,
after I cleared the cache in Symfony
Cannot autowire argument $paginator of "App\Controller\DataController::index()": it references interface "Knp\Component\Pager\PaginatorInterface" but no such service exists. Did you create a class that implements this interface?
Kernel->handle()
in public/index.php (line 28)
Request::setTrustedHosts([$trustedHosts]);}$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);$request = Request::createFromGlobals();$response = $kernel->handle($request);$response->send();$kernel->terminate($request, $response);
Hi,
error Cannot autowire argument $paginator of "App\Controller\DataController::index()": it references interface "Knp\Component\Pager\PaginatorInterface" but no such service exists. Did you create a class that implements this interface?
I solved it originally by removing the knplabs / knp-paginator-bundle package and then adding it again:
At that moment it works ....
However, the problem all the time was that I was constantly rewriting bundes.php, it was missing there:
after I cleared the cache in Symfony
php bin/console cache:pool:clear cache.global_clearer
, the Knp\Component\Pager\PaginatorInterface package stopped working with the error:Cannot autowire argument $paginator of "App\Controller\DataController::index()": it references interface "Knp\Component\Pager\PaginatorInterface" but no such service exists. Did you create a class that implements this interface?
Kernel->handle()
in public/index.php (line 28)
Request::setTrustedHosts([$trustedHosts]);}$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);$request = Request::createFromGlobals();$response = $kernel->handle($request);$response->send();$kernel->terminate($request, $response);
REPLY
Hi,
error Cannot autowire argument $paginator of "App\Controller\DataController::index()": it references interface "Knp\Component\Pager\PaginatorInterface" but no such service exists. Did you create a class that implements this interface?
I solved it originally by removing the knplabs / knp-paginator-bundle package and then adding it again:
composer remove knplabs/knp-paginator-bundle
composer require knplabs/knp-paginator-bundle
At that moment it works ....
However, the problem all the time was that I was constantly rewriting bundes.php, it was missing there:
Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true],