I have just set up a new application on Symfony 5.4.15.
The services.yaml looks like this:
`
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones
`
I have tried to get the entity for a user via a controller. The same way I always do it.
But now I get the following error message:
"Cannot autowire argument $user of "App\Controller\Admin\User\DefaultController::edit()": it references class "App\Entity\User" but no such service exists."
When I call bin/console debug:container on the controller, I get the following message:
`
---------------- ---------------------------------------------
Option Value
---------------- ---------------------------------------------
Service ID App\Controller\Admin\User\DefaultController
Class App\Controller\Admin\User\DefaultController
Tags controller.service_arguments
container.service_subscriber
Calls setContainer
Public yes
Synthetic no
Lazy no
Shared yes
Abstract no
Autowired yes
Autoconfigured yes
---------------- ---------------------------------------------
`
I have compared everything with the applications built so far - I can't see any difference.
Am a bit at a loss, does anyone have any ideas ?