From 1834531ea88cd94616d6c047c086117a51a235f6 Mon Sep 17 00:00:00 2001 From: "Christian F." Date: Fri, 4 Apr 2025 10:24:01 +0200 Subject: [PATCH 1/7] Update TranslationRepository.php --- src/Translation/Repository/TranslationRepository.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Translation/Repository/TranslationRepository.php b/src/Translation/Repository/TranslationRepository.php index c4c187b9b..e7daddcfb 100644 --- a/src/Translation/Repository/TranslationRepository.php +++ b/src/Translation/Repository/TranslationRepository.php @@ -63,9 +63,7 @@ public function createTranslations(array $translationData): void /** @var CreateTranslationData $translation */ foreach ($translationData as $translation) { if ($this->getTranslationByKey($translation->getKey()) !== null) { - throw new ElementExistsException( - sprintf("Translation with key '%s' already exists", $translation->getKey()), - ); + continue; } $this->createTranslationEntry($translation->getKey(), $translation->getType(), $languages); From 84f77e1fa74c95660c1c3e98d9ad93a7d9001a2d Mon Sep 17 00:00:00 2001 From: "Christian F." Date: Fri, 4 Apr 2025 10:25:02 +0200 Subject: [PATCH 2/7] Update TranslationRepositoryInterface.php --- src/Translation/Repository/TranslationRepositoryInterface.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Translation/Repository/TranslationRepositoryInterface.php b/src/Translation/Repository/TranslationRepositoryInterface.php index 2c9b40d98..991a19052 100644 --- a/src/Translation/Repository/TranslationRepositoryInterface.php +++ b/src/Translation/Repository/TranslationRepositoryInterface.php @@ -33,9 +33,6 @@ interface TranslationRepositoryInterface */ public function getAllTranslations(string $locale): array; - /** - * @throws ElementExistsException - */ public function createTranslations(array $translationData): void; /** From 98851c045fa88a22d148efb0e25afc44c7506b96 Mon Sep 17 00:00:00 2001 From: "Christian F." Date: Fri, 4 Apr 2025 10:25:39 +0200 Subject: [PATCH 3/7] remove exception phpdoc --- src/Translation/Service/TranslatorServiceInterface.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Translation/Service/TranslatorServiceInterface.php b/src/Translation/Service/TranslatorServiceInterface.php index f35b12844..55776bbcb 100644 --- a/src/Translation/Service/TranslatorServiceInterface.php +++ b/src/Translation/Service/TranslatorServiceInterface.php @@ -29,9 +29,6 @@ interface TranslatorServiceInterface { public const string DOMAIN = 'studio'; - /** - * @throws ElementExistsException - */ public function createTranslations(CreateTranslation $translation): void; /** From 2ecaa288f77181bf5370aa1f27d2fc630f410ecb Mon Sep 17 00:00:00 2001 From: "Christian F." Date: Fri, 4 Apr 2025 10:26:25 +0200 Subject: [PATCH 4/7] remove inheritdoc --- src/Translation/Service/TranslatorService.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Translation/Service/TranslatorService.php b/src/Translation/Service/TranslatorService.php index 8f3e8e786..81afd80ea 100644 --- a/src/Translation/Service/TranslatorService.php +++ b/src/Translation/Service/TranslatorService.php @@ -42,9 +42,6 @@ public function __construct( $this->translatorBag = $this->getTranslatorBag(); } - /** - * {@inheritdoc} - */ public function createTranslations(CreateTranslation $translation): void { $this->translationRepository->createTranslations($translation->getTranslationData()); From 1348dc77ec42a65431ac3cfdb95a12720ae9fcb6 Mon Sep 17 00:00:00 2001 From: "Christian F." Date: Fri, 4 Apr 2025 10:27:24 +0200 Subject: [PATCH 5/7] remove HttpResponseCodes::CONFLICT --- src/Translation/Controller/CreateController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Translation/Controller/CreateController.php b/src/Translation/Controller/CreateController.php index 54c3f5b55..761b5009a 100644 --- a/src/Translation/Controller/CreateController.php +++ b/src/Translation/Controller/CreateController.php @@ -64,7 +64,6 @@ public function __construct( description: 'translation_create_success_response' )] #[DefaultResponses([ - HttpResponseCodes::CONFLICT, HttpResponseCodes::NOT_FOUND, HttpResponseCodes::UNAUTHORIZED, ])] From 78bc917dc73f2db8b0a2ba4eed1a8eab834d3f83 Mon Sep 17 00:00:00 2001 From: "Christian F." Date: Fri, 4 Apr 2025 10:27:57 +0200 Subject: [PATCH 6/7] remove not needed phpdoc --- src/Translation/Repository/TranslationRepository.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Translation/Repository/TranslationRepository.php b/src/Translation/Repository/TranslationRepository.php index e7daddcfb..9d9885ab1 100644 --- a/src/Translation/Repository/TranslationRepository.php +++ b/src/Translation/Repository/TranslationRepository.php @@ -53,9 +53,6 @@ public function getAllTranslations(string $locale): array return $list->getTranslations(); } - /** - * {@inheritdoc} - */ public function createTranslations(array $translationData): void { $languages = $this->adminResolver->getLanguages(); From 7916415ef41bf9dd727bf26b76fe338527e38b62 Mon Sep 17 00:00:00 2001 From: Corepex <16717695+Corepex@users.noreply.github.com> Date: Fri, 4 Apr 2025 08:29:16 +0000 Subject: [PATCH 7/7] Apply php-cs-fixer changes --- src/Translation/Repository/TranslationRepository.php | 2 -- src/Translation/Repository/TranslationRepositoryInterface.php | 1 - src/Translation/Service/TranslatorServiceInterface.php | 1 - 3 files changed, 4 deletions(-) diff --git a/src/Translation/Repository/TranslationRepository.php b/src/Translation/Repository/TranslationRepository.php index 9d9885ab1..70fc4d2df 100644 --- a/src/Translation/Repository/TranslationRepository.php +++ b/src/Translation/Repository/TranslationRepository.php @@ -17,7 +17,6 @@ namespace Pimcore\Bundle\StudioBackendBundle\Translation\Repository; use Pimcore\Bundle\StaticResolverBundle\Lib\Tools\AdminResolverInterface; -use Pimcore\Bundle\StudioBackendBundle\Exception\Api\ElementExistsException; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\InvalidLocaleException; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; use Pimcore\Bundle\StudioBackendBundle\Translation\Schema\CreateTranslationData; @@ -26,7 +25,6 @@ use Pimcore\Model\Translation; use Pimcore\Model\Translation\Listing; use function in_array; -use function sprintf; /** * @internal diff --git a/src/Translation/Repository/TranslationRepositoryInterface.php b/src/Translation/Repository/TranslationRepositoryInterface.php index 991a19052..6b02e99b2 100644 --- a/src/Translation/Repository/TranslationRepositoryInterface.php +++ b/src/Translation/Repository/TranslationRepositoryInterface.php @@ -16,7 +16,6 @@ namespace Pimcore\Bundle\StudioBackendBundle\Translation\Repository; -use Pimcore\Bundle\StudioBackendBundle\Exception\Api\ElementExistsException; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\InvalidLocaleException; use Pimcore\Bundle\StudioBackendBundle\Translation\Schema\TranslationData; use Pimcore\Model\Translation; diff --git a/src/Translation/Service/TranslatorServiceInterface.php b/src/Translation/Service/TranslatorServiceInterface.php index 55776bbcb..40d66446f 100644 --- a/src/Translation/Service/TranslatorServiceInterface.php +++ b/src/Translation/Service/TranslatorServiceInterface.php @@ -16,7 +16,6 @@ namespace Pimcore\Bundle\StudioBackendBundle\Translation\Service; -use Pimcore\Bundle\StudioBackendBundle\Exception\Api\ElementExistsException; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\InvalidLocaleException; use Pimcore\Bundle\StudioBackendBundle\Translation\Schema\CreateTranslation; use Pimcore\Bundle\StudioBackendBundle\Translation\Schema\Translation;