Skip to content

Commit

Permalink
[Mime] Add TemplatedEmail::$locale to the serialized props (fixes sym…
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrauser committed Nov 24, 2023
1 parent b85a083 commit c28de13
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Mime/TemplatedEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ public function markAsRendered(): void
*/
public function __serialize(): array
{
return [$this->htmlTemplate, $this->textTemplate, $this->context, parent::__serialize()];
return [$this->htmlTemplate, $this->textTemplate, $this->context, $this->locale, parent::__serialize()];
}

/**
* @internal
*/
public function __unserialize(array $data): void
{
[$this->htmlTemplate, $this->textTemplate, $this->context, $parentData] = $data;
[$this->htmlTemplate, $this->textTemplate, $this->context, $this->locale, $parentData] = $data;

parent::__unserialize($parentData);
}
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Bridge/Twig/Tests/Mime/TemplatedEmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ public function testSerialize()
->textTemplate('text.txt.twig')
->htmlTemplate('text.html.twig')
->context($context = ['a' => 'b'])
->locale($locale = 'fr_FR')
;

$email = unserialize(serialize($email));
$this->assertEquals('text.txt.twig', $email->getTextTemplate());
$this->assertEquals('text.html.twig', $email->getHtmlTemplate());
$this->assertEquals($context, $email->getContext());
$this->assertEquals($locale, $email->getLocale());
}

public function testSymfonySerialize()
Expand Down

0 comments on commit c28de13

Please sign in to comment.