When saving translations, some of which have an empty value (null or empty string), only the last value is written to the database.
↪️ To Reproduce
Execute
$promotion->replaceTranslations('name', [
"uk" => "Діти від 10 до 15 років",
"ru" => "Дети от 10 до 15 лет",
"en" => "Children from 10 to 15 years old",
"pl" => "Podziewać od 10 do 15 lat",
"de" => null,
"cs" => null,
"fr" => null,
"es" => null,
"it" => null,
]);
$promotion->save();
Then execute
$promotion->getTranslations('name');
The result will be correct
But in the value saved in the database we see the following
$promotion->getOriginal('name');
✅ Expected behavior
[
"uk" => "Діти від 10 до 15 років",
"ru" => "Дети от 10 до 15 лет",
"en" => "Children from 10 to 15 years old",
"pl" => "Podziewać od 10 do 15 lat",
"de" => null,
"cs" => null,
"fr" => null,
"es" => null,
"it" => null,
]
or
[
"uk" => "Діти від 10 до 15 років",
"ru" => "Дети от 10 до 15 лет",
"en" => "Children from 10 to 15 years old",
"pl" => "Podziewać od 10 do 15 lat",
]
✏️ Describe the bug
When saving translations, some of which have an empty value (
null
or empty string), only the last value is written to the database.↪️ To Reproduce
Execute
Then execute
The result will be correct
But in the value saved in the database we see the following
✅ Expected behavior
or