diff --git a/src/Controller/MemberController.php b/src/Controller/MemberController.php index 7581685..6a4cd6b 100644 --- a/src/Controller/MemberController.php +++ b/src/Controller/MemberController.php @@ -166,6 +166,7 @@ private function createPayment(Customer $customer, float $contributionAmount) { public function handleRedirect(Request $request, string $customerId): Response { $membershipApplicationRepository = $this->getDoctrine()->getRepository(MembershipApplication::class); + /** @var MembershipApplication $membershipApplication */ $membershipApplication = $membershipApplicationRepository->findOneByMollieCustomerId($customerId); if ($membershipApplication !== null && $membershipApplication->getPaid()) @@ -181,19 +182,21 @@ public function handleRedirect(Request $request, string $customerId): Response $templatePrefix = 'custom/'; } - $member = $this->getUser(); + $memberEmail = $membershipApplication->getEmail(); + $memberFullName = $membershipApplication->getFullName(); + $memberFirstName = $membershipApplication->getFirstName(); $emailSender = $this->getParameter('app.noReplyAddress'); $organizationName = $this->getParameter('app.organizationEmail'); $message = (new Email()) ->subject("Bedankt voor je aanmelding bij $organizationName!") - ->to(new Address($member->getEmail(), $member->getFullName())) + ->to(new Address($memberEmail, $memberFullName)) ->from(new Address($emailSender, $organizationName)) ->html( - $this->renderView($templatePrefix . 'email/html/apply.html.twig', ['member' => $member]) + $this->renderView($templatePrefix . 'email/html/apply.html.twig', ['memberFirstName' => $memberFirstName]) ) ->text( - $this->renderView($templatePrefix . 'email/text/apply.txt.twig', ['member' => $member]) + $this->renderView($templatePrefix . 'email/text/apply.txt.twig', ['memberFirstName' => $memberFirstName]) ); $this->mailer->send($message); diff --git a/templates/email/html/apply.html.twig b/templates/email/html/apply.html.twig index 5bbdbf6..d2d6c74 100644 --- a/templates/email/html/apply.html.twig +++ b/templates/email/html/apply.html.twig @@ -1,7 +1,7 @@ {% extends 'email/html/layout.html.twig' %} {% block content %}
- Beste {{ member.firstName }}, + Beste {{ memberFirstName }},
Bedankt voor het aanmelden bij {{ organisatienaam }}. De afdeling zal je aanmelding verwerken waarna u nog een bevestigingsmail zult ontvangen. diff --git a/templates/email/text/apply.txt.twig b/templates/email/text/apply.txt.twig index 5d927d8..f0917c2 100644 --- a/templates/email/text/apply.txt.twig +++ b/templates/email/text/apply.txt.twig @@ -1,6 +1,6 @@ {% extends 'email/text/layout.txt.twig' %} {% block content %} -Beste {{ member.firstName }}, +Beste {{ memberFirstName }}, Bedankt voor het aanmelden bij {{ organisatienaam }}. De afdeling zal je aanmelding verwerken waarna u nog een bevestigingsmail zult ontvangen.