From dcf0716d8d0103c5389e48fe4a8787274e004728 Mon Sep 17 00:00:00 2001 From: Ramseyer Claude Date: Thu, 4 Oct 2018 22:43:10 +0200 Subject: [PATCH] Fix KNP empty translations still persisted (#321) --- src/Form/EventListener/TranslationsListener.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Form/EventListener/TranslationsListener.php b/src/Form/EventListener/TranslationsListener.php index bfba6d5..23e9cdb 100644 --- a/src/Form/EventListener/TranslationsListener.php +++ b/src/Form/EventListener/TranslationsListener.php @@ -71,7 +71,9 @@ public function submit(FormEvent $event): void foreach ($data as $locale => $translation) { // Remove useless Translation object - if (empty($translation)) { + if ((method_exists($translation, 'isEmpty') && $translation->isEmpty()) // Knp + || empty($translation) // Default + ) { $data->removeElement($translation); continue; }