I would like to send my FOSUserBundle emails via the Symfony's new mailer component.
Given these instructions, I need to create a service that implements the FOSUserBundle MailerInterface. Thus I created a service and implemented the methods.
<?php
namespace App\Service;
// some use statements
class FOSUserSendgridMailer implements MailerInterface
{...
Now I want to reference this new service in the fos_user_yaml by:
fos_user:
db_driver: orm # other valid values are 'mongodb' and 'couchdb'
firewall_name: main
service:
mailer: App\Service\FOSUserSendgridMailer
I then get an error The service "fos_user.listener.email_confirmation" has a dependency on a non-existent service "App\Service\FOSUserSendgridMailer".
Autowire and autoconfigure are both set to true
in services.yaml
.
How do I reference my new service correctly?
You need to define it as a service in services.yaml like this:
App\Service\FOSUserSendgridMailer:
class: App\Service\FOSUserSendgridMailer