Answer the question
In order to leave comments, you need to log in
How to understand the strange behavior of services in Symfony?
I declare a named service
some.easy_service:
class: SomeVendor\Services\EasyService
arguments:
...
SomeVendor\SomeBundle\Services\AnotherService:
arguments:
$easyService: '@some.easy_service'
...
Cannot autowire service "SomeVendor\SomeBundle\Services\AnotherService": argument "$easyService" of method "__construct()" references class "SomeVendor\Services\EasyService" but no such service exists. You should maybe alias this class to the existing "some.easy_service" service.
Answer the question
In order to leave comments, you need to log in
There are two options:
1) in a certain version, the declaration through the class is outdated, it is necessary through alias
https://symfony.com/doc/current/service_container/...
2) the container cache is not regenerated
I am generally a supporter of full namespaces, without aliases in configs
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question