Skip to content

Commit 514d5ca

Browse files
committed
fis translations update
1 parent 316727f commit 514d5ca

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Ushahidi/Modules/V5/Actions/V5CommandHandler.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Ushahidi\Modules\V5\Actions;
44

55
use App\Bus\Command\AbstractCommandHandler;
6+
use Hamcrest\Arrays\IsArray;
67
use Ushahidi\Modules\V5\Models\Translation;
78
use Illuminate\Http\JsonResponse;
89
use Illuminate\Http\Exceptions\HttpResponseException;
@@ -104,11 +105,17 @@ protected function updateTranslations(
104105
int $translatable_id,
105106
string $type
106107
) {
107-
if (empty($translation_input)) {
108-
return [];
108+
// if (empty($translation_input)) {
109+
// return [];
110+
// }
111+
if (is_array($translation_input)) {
112+
Translation::where('translatable_id', $translatable_id)->where('translatable_type', $type)->delete();
113+
if (count($translation_input)) {
114+
return $this->saveTranslations($entity, $entity_array, $translation_input, $translatable_id, $type);
115+
}
109116
}
110-
Translation::where('translatable_id', $translatable_id)->where('translatable_type', $type)->delete();
111-
return $this->saveTranslations($entity, $entity_array, $translation_input, $translatable_id, $type);
117+
return [];
118+
// return $this->saveTranslations($entity, $entity_array, $translation_input, $translatable_id, $type);
112119
} //end updateTranslations()
113120

114121
/**

0 commit comments

Comments
 (0)