Skip to content

Commit e3b335e

Browse files
committed
Merge local variables with globals
With this PR, globals defined variables aren't available on email twig templates.
1 parent e047dd8 commit e3b335e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Mailer/TwigSwiftMailer.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ public function sendConfirmationEmailMessage(UserInterface $user)
3737
{
3838
$template = $this->parameters['template']['confirmation'];
3939
$url = $this->router->generate('fos_user_registration_confirm', array('token' => $user->getConfirmationToken()), true);
40-
$context = array(
40+
41+
$context = $this->twig->mergeGlobals(array(
4142
'user' => $user,
4243
'confirmationUrl' => $url
43-
);
44+
));
4445

4546
$this->sendMessage($template, $context, $this->parameters['from_email']['confirmation'], $user->getEmail());
4647
}
@@ -49,10 +50,12 @@ public function sendResettingEmailMessage(UserInterface $user)
4950
{
5051
$template = $this->parameters['template']['resetting'];
5152
$url = $this->router->generate('fos_user_resetting_reset', array('token' => $user->getConfirmationToken()), true);
52-
$context = array(
53+
54+
$context = $this->twig->mergeGlobals(array(
5355
'user' => $user,
5456
'confirmationUrl' => $url
55-
);
57+
));
58+
5659
$this->sendMessage($template, $context, $this->parameters['from_email']['resetting'], $user->getEmail());
5760
}
5861

0 commit comments

Comments
 (0)