Created
November 28, 2016 11:25
-
-
Save adrianpietka/77b5bd3c92ee7fa3a324582b22dd3159 to your computer and use it in GitHub Desktop.
Separate accepted email template for each national center
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class EmailNotificationSubscriber | |
| { | |
| public function handleAcceptedForm(AcceptedFormEvent $event) | |
| { | |
| $this->sendEmailToReferrer(EmailTemplateCode::REFERRAL_FORM_ACCEPTED, $event->getFormId()); | |
| $this->sendAcceptedEmailToNationalCenter($event->getFormId()); | |
| } | |
| public function sendAcceptedEmailToNationalCenter($formId) | |
| { | |
| $referralForm = $this->referralFormRepository->getById($formId); | |
| $templateId = EmailTemplateCode::acceptCode($referralForm->getNationalCentre()); | |
| $this->sendAcceptedEmailToNationalCentre($templateId, $formId); | |
| } | |
| } | |
| class EmailTemplateCode | |
| { | |
| const REFERRAL_FORM_ACCEPTED_LONDON = 'referral_form.accepted.london'; | |
| const REFERRAL_FORM_ACCEPTED_SCOTLAND = 'referral_form.accepted.scotland'; | |
| public static function acceptCode($nationalCenter) { | |
| return [ | |
| 1 => self::REFERRAL_FORM_ACCEPTED_LONDON, | |
| 5 => self::REFERRAL_FORM_ACCEPTED_SCOTLAND | |
| ]; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment