protected function subscribe(RequestDataBag
$dataBag, CustomerEntity
$customer, SalesChannelContext
$context, NewsletterAccountPagelet
$newsletterAccountPagelet): NewsletterAccountPagelet
{ try { $this->newsletterSubscribeRoute->
subscribe( $this->
hydrateFromCustomer($dataBag,
$customer),
$context,
false
);
$newsletterAccountPagelet->
setSuccess(true
);
if ($newsletterAccountPagelet->
isNewsletterDoi()) { $text =
$this->translator->
trans('newsletter.subscriptionPersistedSuccess'
);
} else { $text =
$this->translator->
trans('newsletter.subscriptionConfirmationSuccess'
);
} $newsletterAccountPagelet->
setMessages( [ [ 'type' => 'success',
'text' =>
$text,
],
]