texts_to_delete as $text_description_to_delete) { $text_to_delete = TextSetting::find()->where(['description' => $text_description_to_delete])->one(); if ($text_to_delete) { $text_to_delete->delete(); } } foreach ($this->texts_to_update as [$old_description, $new_description, $new_tooltip_description]) { $text_to_delete = TextSetting::find()->where(['description' => $old_description])->orderBy(['order' => SORT_ASC])->one(); if ($text_to_delete) { if ($new_description) { $text_to_delete->description = $new_description; } $text_to_delete->tooltip_description = $new_tooltip_description; $text_to_delete->save(false); } } } }