@@ -460,7 +460,12 @@ private function activateCustomer($customer, $confirmationKey)
460
460
461
461
$ customer ->setConfirmation (null );
462
462
$ this ->customerRepository ->save ($ customer );
463
- $ this ->getEmailNotification ()->newAccount ($ customer , 'confirmed ' , '' , $ this ->storeManager ->getStore ()->getId ());
463
+ $ this ->getEmailNotification ()->newAccount (
464
+ $ customer ,
465
+ 'confirmed ' ,
466
+ '' ,
467
+ $ this ->storeManager ->getStore ()->getId ()
468
+ );
464
469
return $ customer ;
465
470
}
466
471
@@ -531,17 +536,8 @@ public function initiatePasswordReset($email, $template, $websiteId = null)
531
536
$ this ->getEmailNotification ()->passwordResetConfirmation ($ customer );
532
537
break ;
533
538
default :
534
- throw new InputException (
535
- __ (
536
- 'Invalid value of "%value" provided for the %fieldName field. Possible values are %template1 or %template2. ' ,
537
- [
538
- 'value ' => $ template ,
539
- 'fieldName ' => 'template ' ,
540
- 'template1 ' => AccountManagement::EMAIL_REMINDER ,
541
- 'template2 ' => AccountManagement::EMAIL_RESET
542
- ]
543
- )
544
- );
539
+ $ this ->handleUnknownTemplate ($ template );
540
+ break ;
545
541
}
546
542
return true ;
547
543
} catch (MailException $ e ) {
@@ -551,6 +547,25 @@ public function initiatePasswordReset($email, $template, $websiteId = null)
551
547
return false ;
552
548
}
553
549
550
+ /**
551
+ * Handle not supported template
552
+ *
553
+ * @param string $template
554
+ * @throws InputException
555
+ */
556
+ private function handleUnknownTemplate ($ template )
557
+ {
558
+ throw new InputException (__ (
559
+ 'Invalid value of "%value" provided for the %fieldName field. Possible values: %template1 or %template2. ' ,
560
+ [
561
+ 'value ' => $ template ,
562
+ 'fieldName ' => 'template ' ,
563
+ 'template1 ' => AccountManagement::EMAIL_REMINDER ,
564
+ 'template2 ' => AccountManagement::EMAIL_RESET
565
+ ]
566
+ ));
567
+ }
568
+
554
569
/**
555
570
* {@inheritdoc}
556
571
*/
@@ -1116,15 +1131,23 @@ protected function sendEmailTemplate(
1116
1131
$ storeId = null ,
1117
1132
$ email = null
1118
1133
) {
1119
- $ templateId = $ this ->scopeConfig ->getValue ($ template , ScopeInterface::SCOPE_STORE , $ storeId );
1134
+ $ templateId = $ this ->scopeConfig ->getValue (
1135
+ $ template ,
1136
+ ScopeInterface::SCOPE_STORE ,
1137
+ $ storeId
1138
+ );
1120
1139
if ($ email === null ) {
1121
1140
$ email = $ customer ->getEmail ();
1122
1141
}
1123
1142
1124
1143
$ transport = $ this ->transportBuilder ->setTemplateIdentifier ($ templateId )
1125
1144
->setTemplateOptions (['area ' => Area::AREA_FRONTEND , 'store ' => $ storeId ])
1126
1145
->setTemplateVars ($ templateParams )
1127
- ->setFrom ($ this ->scopeConfig ->getValue ($ sender , ScopeInterface::SCOPE_STORE , $ storeId ))
1146
+ ->setFrom ($ this ->scopeConfig ->getValue (
1147
+ $ sender ,
1148
+ ScopeInterface::SCOPE_STORE ,
1149
+ $ storeId
1150
+ ))
1128
1151
->addTo ($ email , $ this ->customerViewHelper ->getCustomerName ($ customer ))
1129
1152
->getTransport ();
1130
1153
@@ -1318,8 +1341,10 @@ protected function getFullCustomerObject($customer)
1318
1341
// No need to flatten the custom attributes or nested objects since the only usage is for email templates and
1319
1342
// object passed for events
1320
1343
$ mergedCustomerData = $ this ->customerRegistry ->retrieveSecureData ($ customer ->getId ());
1321
- $ customerData =
1322
- $ this ->dataProcessor ->buildOutputDataArray ($ customer , \Magento \Customer \Api \Data \CustomerInterface::class);
1344
+ $ customerData = $ this ->dataProcessor ->buildOutputDataArray (
1345
+ $ customer ,
1346
+ \Magento \Customer \Api \Data \CustomerInterface::class
1347
+ );
1323
1348
$ mergedCustomerData ->addData ($ customerData );
1324
1349
$ mergedCustomerData ->setData ('name ' , $ this ->customerViewHelper ->getCustomerName ($ customer ));
1325
1350
return $ mergedCustomerData ;
0 commit comments