File tree Expand file tree Collapse file tree 3 files changed +6
-2
lines changed
Expand file tree Collapse file tree 3 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ class ImportSubscriberDto
2828 /** @var array<string, string|int|bool|null> */
2929 public array $ extraAttributes = [];
3030
31+ public bool $ sendConfirmation ;
32+
3133 public function __construct (
3234 string $ email ,
3335 bool $ confirmed ,
@@ -39,6 +41,7 @@ public function __construct(
3941 ) {
4042 $ this ->email = $ email ;
4143 $ this ->confirmed = $ confirmed ;
44+ $ this ->sendConfirmation = !$ confirmed ;
4245 $ this ->blacklisted = $ blacklisted ;
4346 $ this ->htmlEmail = $ htmlEmail ;
4447 $ this ->disabled = $ disabled ;
Original file line number Diff line number Diff line change @@ -118,11 +118,11 @@ public function createFromImport(ImportSubscriberDto $subscriberDto): Subscriber
118118 $ subscriber ->setBlacklisted ($ subscriberDto ->blacklisted );
119119 $ subscriber ->setHtmlEmail ($ subscriberDto ->htmlEmail );
120120 $ subscriber ->setDisabled ($ subscriberDto ->disabled );
121- $ subscriber ->setExtraData ($ subscriberDto ->extraData );
121+ $ subscriber ->setExtraData ($ subscriberDto ->extraData ?? '' );
122122
123123 $ this ->entityManager ->persist ($ subscriber );
124124
125- if (! $ subscriberDto ->confirmed ) {
125+ if ($ subscriberDto ->sendConfirmation ) {
126126 $ this ->sendConfirmationEmail ($ subscriber );
127127 }
128128
Original file line number Diff line number Diff line change @@ -143,6 +143,7 @@ private function processRow(
143143 return ;
144144 } else {
145145 $ dto ->email = 'invalid_ ' . $ dto ->email ;
146+ $ dto ->sendConfirmation = false ;
146147 }
147148 }
148149 $ subscriber = $ this ->subscriberRepository ->findOneByEmail ($ dto ->email );
You can’t perform that action at this time.
0 commit comments