Skip to content

Commit

Permalink
Merge branch 'master' into display-issues-correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-meyer committed Jul 20, 2023
2 parents abf2083 + 53c5b99 commit 4c4aa74
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Classes/Command/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ protected function saveToDatabase(Document $document)
if ($doc === null) {
return false;
}
$persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class);
$doc->cPid = $this->storagePid;

$metadata = $doc->getTitledata($this->storagePid);
Expand Down Expand Up @@ -212,6 +213,8 @@ protected function saveToDatabase(Document $document)
$documentCollection->setDescription('');
// add to CollectionRepository
$this->collectionRepository->add($documentCollection);
// persist collection to prevent duplicates
$persistenceManager->persistAll();
}
// add to document
$document->addCollection($documentCollection);
Expand Down Expand Up @@ -273,7 +276,6 @@ protected function saveToDatabase(Document $document)
$this->documentRepository->update($document);
}

$persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class);
$persistenceManager->persistAll();

return true;
Expand Down

0 comments on commit 4c4aa74

Please sign in to comment.