How to delete a translation of a nullable fields?
Opened this issue · 0 comments
matperez commented
Hello!
Thank you for behavior, it saved me a lot of time! Now I have an issue. I used it in my model
'class' => MultilingualBehavior::class,
'languages' => [
'ru' => 'Russian',
'en-En' => 'English',
],
'defaultLanguage' => 'ru',
'langForeignKey' => 'counterparty_id',
'tableName' => '{{%counterpartyLang}}',
'attributes' => [
'message',
]
Everything seems to work fine except of one thing. I can not delete the value of message
field in english. I can only set it to a different value, not no null. According to the source code it is the intended behavior, you only update the field if it's not null.
if ($value !== null) {
$field = $this->localizedPrefix . $attribute;
$translation->$field = $value;
$save = true;
}
So how can I delete an existing translation? How to cope with a nullable fields?