8000 [Mime] Add `TemplatedEmail::$locale` to the serialized props · symfonyaml/symfony@cedb7cc · GitHub
[go: up one dir, main page]

Skip to content

Commit cedb7cc

Browse files
mkrauserfabpot
authored andcommitted
[Mime] Add TemplatedEmail::$locale to the serialized props
1 parent b85a083 commit cedb7cc

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 0 deletions
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