Search code examples
symfonyapi-platform.commailer

sending confirm email if email is changed in usersettings with symfony mailer


I am trying to send an email if the user is changeing his email. but I don´t know hot to tell the eventhandler when to send the email.Symfony Mailer Handler

Now the email is send when a PUT request is send but i only should be send if the email is changed.


Solution

  • in API Platform Event Subscriber, you can access the object before new data are hydrated with $event->getRequest()->attributes->get('previous_data').