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

Autor Commander
Publikováno 17.11.2020
Kategorie programovani
Stav Vyřešeno
Dobrý den,

poté co jsem v Symfony promazal cache php bin/console cache:pool:clear cache.global_clearer, tak přestal fungovat balíček Knp\Component\Pager\PaginatorInterface s chybou:

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);


Odpovědi na dotaz

The English language is translated by machine - the translator can modify eg cited codes = it is better to use codes from the Czech original.

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);

RE: Symfony - Cannot autowire argument $paginator -…

Autor Commander
Publikováno 03.12.2020
Kategorie programovani
Stav Zkontrolováno
Dobrý den,

chybu 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?

jsem vyřešil původně tak, že jsem odebral balíček knplabs/knp-paginator-bundle a pak ho zase přidal:

composer remove knplabs/knp-paginator-bundle
composer require knplabs/knp-paginator-bundle

V tu chvíli to jelo....

Nicméně problém byl celou dobu v tom, že jsem si neustále přepisoval bundes.php, chybělo tam:
Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true],


The English language is translated by machine - the translator can modify eg cited codes = it is better to use codes from the Czech original.

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

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

Tento web používá k poskytování služeb, personalizaci reklam a analýze návštěvnosti soubory cookie. Používáním tohoto webu s tím souhlasíte. Další informace