From 94afdf43ef3d9780c53e8f74f377b4cf74abe927 Mon Sep 17 00:00:00 2001 From: Guillaume Sainthillier Date: Mon, 17 Apr 2023 09:14:36 +0200 Subject: [PATCH] Don't call containsKey when locale is null (#62) --- src/Model/TranslatableTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/TranslatableTrait.php b/src/Model/TranslatableTrait.php index f30542e..08c49bd 100644 --- a/src/Model/TranslatableTrait.php +++ b/src/Model/TranslatableTrait.php @@ -145,7 +145,7 @@ public function getTranslations(): Collection public function hasTranslation(TranslationInterface $translation): bool { return isset($this->translationsCache[$translation->getLocale()]) - || $this->translations->containsKey($translation->getLocale()); + || (null !== $translation->getLocale() && $this->translations->containsKey($translation->getLocale())); } /**