From aed8acb9027391ff516d0d09d9255aa7ef25828c Mon Sep 17 00:00:00 2001 From: C-burr <30287946+C-burr@users.noreply.github.com> Date: Thu, 11 Nov 2021 10:41:49 +0100 Subject: [PATCH] XLIFF Import Publish state fix for ArticleImport (#595) --- Import/ArticleImport.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Import/ArticleImport.php b/Import/ArticleImport.php index 4b3ef3b02..ddb8c5e4e 100644 --- a/Import/ArticleImport.php +++ b/Import/ArticleImport.php @@ -19,6 +19,7 @@ use Sulu\Bundle\DocumentManagerBundle\Bridge\DocumentInspector; use Sulu\Component\Content\Compat\Structure\LegacyPropertyFactory; use Sulu\Component\Content\Compat\StructureManagerInterface; +use Sulu\Component\Content\Document\WorkflowStage; use Sulu\Component\Content\Extension\ExportExtensionInterface; use Sulu\Component\Content\Extension\ExtensionInterface; use Sulu\Component\Content\Extension\ExtensionManagerInterface; @@ -182,7 +183,11 @@ protected function importDocument(array $parsedData, string $format, string $loc // save document $this->documentManager->persist($document, $locale); - $this->documentManager->publish($document, $locale); + + if (WorkflowStage::PUBLISHED === ((int) $this->getParser($format)->getPropertyData('workflowStage', $data))) { + $this->documentManager->publish($document, $locale); + } + $this->documentManager->flush(); $this->documentRegistry->clear(); } catch (\Exception $e) {