Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Symfony2][Symfony][SF]Cannot autowire service/but no such service exists
symer
post
Post #1





Grupa: Zarejestrowani
Postów: 66
Pomógł: 0
Dołączył: 24.08.2017

Ostrzeżenie: (0%)
-----


Próbuje wstrzyknąć obiekt do service ale niestety wyskakuje mi błąd: Cannot autowire service ... but no such service exists :

"Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\AutowiringFailedException' with message 'Cannot autowire service "AppBundle\Service\ValidResponse": argument "$filter" of method "__construct()" references class "Symfony\Component\HttpKernel\Event\FilterResponseEvent" but no such service exists. It cannot be auto-registered because it is from a different root namespace.' in C:\xampp\htdocs\heroku\testsymf\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Compiler\AutowirePass.php:285 Stack trace: #0 C:\xampp\htdocs\heroku\testsymf\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Compiler\AutowirePass.php(217): Symfony\Component\DependencyInjection\Compiler\AutowirePass->autowireMethod(Object(ReflectionMethod), Array) #1 C:\xampp\htdocs\heroku\testsymf\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Compiler\AutowirePass.php(140): Symfony\Component\DependencyInjection\Compiler\AutowirePass->autowireCalls(Object(ReflectionClass), Array, Array) #2 in C:\xampp\htdocs\heroku\testsymf\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Compiler\AutowirePass.php on line 285"

  1. namespace AppBundle\Service ;
  2. use Symfony\Component\HttpKernel\Event\FilterResponseEvent as FilterReponse;
  3. class ValidResponse
  4. {
  5. protected $filter;
  6. public function __construct(FilterReponse $filter)
  7. {
  8. $this->filter = $filter;
  9. }
  10.  
  11.  
  12. }
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 24.12.2025 - 13:22