From a03d356871fcea066c60f52047cf92536ccce7c8 Mon Sep 17 00:00:00 2001 From: andrefatchip Date: Sun, 5 Jan 2020 21:37:27 +0100 Subject: [PATCH] 0057197: Fixed fatal errors occured --- Services/Helper/ShopwareArticleHelper.php | 44 +++++++++++++++++------ 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/Services/Helper/ShopwareArticleHelper.php b/Services/Helper/ShopwareArticleHelper.php index c77e2f2..4ade02f 100644 --- a/Services/Helper/ShopwareArticleHelper.php +++ b/Services/Helper/ShopwareArticleHelper.php @@ -630,7 +630,9 @@ public function createSupplier(string $name) try { $this->entityManager->persist($supplier); $this->entityManager->flush(); - } catch (OptimisticLockException | ORMException $e) { + } catch (OptimisticLockException $e) { + $this->logger->error('Error saving supplier', array($name)); + } catch (ORMException $e) { $this->logger->error('Error saving supplier', array($name)); } @@ -846,7 +848,9 @@ public function createMainArticle() try { $this->entityManager->persist($article); $this->entityManager->flush(); - } catch (OptimisticLockException | ORMException $e) { + } catch (OptimisticLockException $e) { + $this->logger->error('Error saving temporary main article'); + } catch (ORMException $e) { $this->logger->error('Error saving temporary main article'); } @@ -909,7 +913,9 @@ public function createConfiguratorGroup(string $name) try { $this->entityManager->persist($group); $this->entityManager->flush($group); - } catch (OptimisticLockException | ORMException $e) { + } catch (OptimisticLockException $e) { + $this->logger->error('Error saving configurator group', array($name)); + } catch (ORMException $e) { $this->logger->error('Error saving configurator group', array($name)); } @@ -1127,7 +1133,9 @@ public function importArticle( $this->entityManager->persist($shopwareArticle); $this->entityManager->flush(); } - catch(OptimisticLockException | ORMException $e) { + catch(OptimisticLockException $e) { + $this->logger->error('Error storing base article values!'); + } catch (ORMException $e) { $this->logger->error('Error storing base article values!'); } continue; @@ -1159,7 +1167,9 @@ public function importArticle( $this->entityManager->persist($shopwareArticle); $this->entityManager->flush(); - } catch (OptimisticLockException | ORMException $e) { + } catch (OptimisticLockException $e) { + $this->logger->error($e->getMessage()); + } catch (ORMException $e) { $this->logger->error($e->getMessage()); } } @@ -1213,7 +1223,9 @@ public function createUnitFromString(string $unitString) try { $this->entityManager->persist($unit); $this->entityManager->flush(); - } catch (OptimisticLockException | ORMException $e) { + } catch (OptimisticLockException $e) { + $this->logger->error('Error saving unit', array($unit)); + } catch (ORMException $e) { $this->logger->error('Error saving unit', array($unit)); } @@ -1474,7 +1486,9 @@ public function createParentImage( try { $this->entityManager->persist($image); $this->entityManager->flush(); - } catch (OptimisticLockException | ORMException $e) { + } catch (OptimisticLockException $e) { + $this->logger->error($e->getMessage()); + } catch (ORMException $e) { $this->logger->error($e->getMessage()); } @@ -1499,7 +1513,9 @@ public function createChildImage(ArticleImage $parent, ArticleDetail $detail) try { $this->entityManager->persist($image); $this->entityManager->flush(); - } catch (OptimisticLockException | ORMException $e) { + } catch (OptimisticLockException $e) { + $this->logger->error($e->getMessage()); + } catch (ORMException $e) { $this->logger->error($e->getMessage()); } @@ -1571,7 +1587,9 @@ public function createFilterGroup(string $groupName) try { $this->entityManager->persist($filterGroup); $this->entityManager->flush(); - } catch (OptimisticLockException | ORMException $e) { + } catch (OptimisticLockException $e) { + $this->logger->error('Error saving FilterGroup'); + } catch (ORMException $e) { $this->logger->error('Error saving FilterGroup'); } } @@ -1610,7 +1628,9 @@ public function createFilterOption(FilterGroup $filterGroup, string $optionName) try { $this->entityManager->persist($option); $this->entityManager->flush(); - } catch (OptimisticLockException | ORMException $e) { + } catch (OptimisticLockException $e) { + $this->logger->error('Error saving FilterOption'); + } catch (ORMException $e) { $this->logger->error('Error saving FilterOption'); } @@ -1643,7 +1663,9 @@ public function createFilterValue(FilterOption $option, string $valueName) try { $this->entityManager->persist($filterValue); $this->entityManager->flush(); - } catch (OptimisticLockException | ORMException $e) { + } catch (OptimisticLockException $e) { + $this->logger->error('Error saving FilterValue'); + } catch (ORMException $e) { $this->logger->error('Error saving FilterValue'); } }