From f89675a099f166c88e9102c502bc3b53d12c5a1e Mon Sep 17 00:00:00 2001 From: Serhii Zhuravel Date: Tue, 13 Jul 2021 19:56:47 +0300 Subject: [PATCH] AKM-26: OroCommerce import changes compat --- EventListener/AdditionalOptionalListenerTrait.php | 5 +++++ ImportExport/Strategy/ImportStrategyHelper.php | 2 +- ImportExport/Writer/CumulativeWriter.php | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/EventListener/AdditionalOptionalListenerTrait.php b/EventListener/AdditionalOptionalListenerTrait.php index 5b76ed2d..08942bfd 100644 --- a/EventListener/AdditionalOptionalListenerTrait.php +++ b/EventListener/AdditionalOptionalListenerTrait.php @@ -15,4 +15,9 @@ public function disable(): void { $this->enabled = false; } + + public function setEnabled($enabled = true) + { + $this->enabled = (bool)$enabled; + } } diff --git a/ImportExport/Strategy/ImportStrategyHelper.php b/ImportExport/Strategy/ImportStrategyHelper.php index 1d92fd1a..06b1d251 100644 --- a/ImportExport/Strategy/ImportStrategyHelper.php +++ b/ImportExport/Strategy/ImportStrategyHelper.php @@ -93,7 +93,7 @@ public function importEntity($databaseEntity, $importedEntity, array $excludedPr /** * {@inheritdoc} */ - private function getEntityPropertiesByClassName($entityClassName) + protected function getEntityPropertiesByClassName($entityClassName) { /* * In case if we work with configured entities then we should use fieldHelper diff --git a/ImportExport/Writer/CumulativeWriter.php b/ImportExport/Writer/CumulativeWriter.php index c4a19402..e040929c 100644 --- a/ImportExport/Writer/CumulativeWriter.php +++ b/ImportExport/Writer/CumulativeWriter.php @@ -83,7 +83,10 @@ private function doWrite() $this->optionalListenerManager->getListeners() ); foreach ($this->forceListeners as $forceListener) { - $this->optionalListenerManager->enableListener($forceListener); + try { + $this->optionalListenerManager->enableListener($forceListener); + } catch (\InvalidArgumentException $e) { + } } $this->writer->write($this->items);