Skip to content

Commit

Permalink
Merge pull request #1345 from ezsystems/EZP-31449
Browse files Browse the repository at this point in the history
EZP-31449: Adapted TranslatablePropertyTransformer to properly handle nulls
  • Loading branch information
lserwatka authored Apr 17, 2020
2 parents 37dde64 + 463f0c1 commit 7585a8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ public function transform($valueAsHash)

public function reverseTransform($value)
{
if (!$value) {
return null;
}
$value = (false === $value || [] === $value) ? null : $value;

return [$this->languageCode => $value];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public function testReverseTransform($inputValue, $languageCode, $expected)
public function reverseTransformProvider()
{
return [
[false, 'fre-FR', null],
[null, 'fre-FR', null],
[false, 'fre-FR', ['fre-FR' => null]],
[null, 'fre-FR', ['fre-FR' => null]],
['français', 'fre-FR', ['fre-FR' => 'français']],
['english', 'eng-GB', ['eng-GB' => 'english']],
['norsk', 'nor-NO', ['nor-NO' => 'norsk']],
Expand Down

0 comments on commit 7585a8e

Please # to comment.