Symfony - Cannot autowire argument $paginator - it references interface - but no such service exists

Symfony - Cannot autowire argument $paginator - it references interface - but no such service exists

Hi,

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],

Související obsah

programovani

symfony

php

Komentáře

Vaše reakce na Symfony - Cannot autowire argument $paginator - it references interface - but no such service exists

Reference

Podívejte se na naše reference

Prohlédnout

Aplikace

Podívejte se na naše aplikace

Prohlédnout

Co umíme?

Podívejte se co umíme

Prohlédnout

Co umíme?

Vytváříme sofistikované aplikace pro náročné

Od webových aplikací přes android až po převodové můstky či složité informační systémy.

Podívejte se k nám

Máte ještě čas? Podívejte se na další rubriky

Tento web používá soubory cookie. Dalším procházením tohoto webu vyjadřujete souhlas s jejich používáním.. Více informací zde.