I have a Symfony 4 website with users and login process. I'd like to add a new Entity "customer" and allow to the customer to log in using the same process as User.
When I try to edit the security.yaml file, I have this error : Not configuring explicitly the provider for the "guard" listener on "main" firewall is ambiguous as there is more than one registered provider.
My encoders are declared :
encoders:
App\Entity\User:
algorithm: bcrypt
App\Entity\Client:
algorithm: bcrypt
My providers as well : providers:
app_user_provider:
entity:
class: App\Entity\User
property: email
manager_name: user
app_customer_provider:
entity:
class: App\Entity\Customer
property: email
manager_name: customer
And the main firewall :
main:
logout:
path: app_logout
anonymous: true
guard:
authenticators:
- App\Security\LoginFormAuthenticator
I tried different way to declare the new firewall but it doesn't work. Is it possible to use the same Security process for two providers ? Am I missing something ?
Thanks