8000 bug #52719 [Mime] Add `TemplatedEmail::$locale` to the serialized pro… · symfony/symfony@0c9985c · GitHub
[go: up one dir, main page]

Skip to content

Commit 0c9985c

Browse files
committed
bug #52719 [Mime] Add TemplatedEmail::$locale to the serialized props (mkrauser)
This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [Mime] Add `TemplatedEmail::$locale` to the serialized props | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? |no | Deprecations? | no | Issues | Fix #52718 | License | MIT To use the locale-property when working with Symfony Messenger asynchronously it has to be serialized. Commits ------- cedb7cc [Mime] Add `TemplatedEmail::$locale` to the serialized props
2 parents 2e2623d + cedb7cc commit 0c9985c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Symfony/Bridge/Twig/Mime/TemplatedEmail.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function markAsRendered(): void
100100
*/
101101
public function __serialize(): array
102102
{
103-
return [$this->htmlTemplate, $this->textTemplate, $this->context, parent::__serialize()];
103+
return [$this->htmlTemplate, $this->textTemplate, $this->context, parent::__serialize(), $this->locale];
104104
}
105105

106106
/**
@@ -109,6 +109,7 @@ public function __serialize(): array
109109
public function __unserialize(array $data): void
110110
{
111111
[$this->htmlTemplate, $this->textTemplate, $this->context, $parentData] = $data;
112+
$this->locale = $data[4] ?? null;
112113

113114
parent::__unserialize($parentData);
114115
}

src/Symfony/Bridge/Twig/Tests/Mime/TemplatedEmailTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ public function testSerialize()
4343
->textTemplate('text.txt.twig')
4444
->htmlTemplate('text.html.twig')
4545
->context($context = ['a' => 'b'])
46+
->locale($locale = 'fr_FR')
4647
;
4748

4849
$email = unserialize(serialize($email));
4950
$this->assertEquals('text.txt.twig', $email->getTextTemplate());
5051
$this->assertEquals('text.html.twig', $email->getHtmlTemplate());
5152
$this->assertEquals($context, $email->getContext());
53+
$this->assertEquals($locale, $email->getLocale());
5254
}
5355

5456
public function testSymfonySerialize()

0 commit comments

Comments
 (0)
0