Running Symfony 3.3.15 I'm currently having some issues with the autowiring mechanism.
The following deprecation warning is showing up 3 times in my log:
Autowiring services based on the types they implement is deprecated since Symfony 3.3 and won't be supported in version 4.0. You should rename (or alias) the "[email protected]" service to "Symfony\Component\Security\Core\User\UserInterface" instead.
The only place I can imagine this error occurs is my security.yml
since I've defined the user there.
This file has the following content:
security:
encoders:
My\Bundle\CompanyBundle\Entity\Contact:
algorithm: bcrypt
Symfony\Component\Security\Core\User\User:
algorithm: bcrypt
providers:
chain_provider:
chain:
providers: [in_memory, contact_provider]
in_memory:
memory:
users:
[email protected]:
password: "some encrypted password"
roles: ["ROLE_SUPER_ADMIN"]
contact_provider:
entity:
class: MyCompanyBundle:Contact
property: emailAddress
api_user_provider:
entity:
class: ApiBundle:ApiUser
property: apiKey
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
api:
pattern: ^/
stateless: true
provider: api_user_provider
guard:
authenticators:
- App\Component\Security\TokenAuthenticator
main:
anonymous: ~
provider: chain_provider
form_login:
username_parameter: login[username]
password_parameter: login[password]
csrf_parameter: login[_token]
login_path: login
check_path: login
logout:
path: /logout
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
Even if I only specify the in_memory provider in this file, the warning keeps popping up.
Any thoughts?
This appeared to be a bug, users were registered as services.
A fix was made from Symfony 2.7 upwards: https://github.com/symfony/symfony/pull/25837