Respect deleted records policy
This commit is contained in:
parent
7188f37c9f
commit
00d4dc80cc
|
@ -24,7 +24,6 @@ namespace OCC\OaiPmh2\Console;
|
|||
|
||||
use DateTime;
|
||||
use OCC\OaiPmh2\Database;
|
||||
use OCC\OaiPmh2\Database\Record;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
|
@ -160,6 +159,7 @@ class CsvImportCommand extends Command
|
|||
}
|
||||
}
|
||||
Database::getInstance()->flush(true);
|
||||
Database::getInstance()->pruneOrphanSets();
|
||||
|
||||
$output->writeln([
|
||||
'',
|
||||
|
|
|
@ -129,6 +129,11 @@ class Database
|
|||
$format = $this->entityManager->getReference(Format::class, $format);
|
||||
}
|
||||
$record = $this->entityManager->find(Record::class, ['identifier' => $identifier, 'format' => $format]);
|
||||
if (!isset($data) && Configuration::getInstance()->deletedRecords === 'no') {
|
||||
if (isset($record)) {
|
||||
$this->entityManager->remove($record);
|
||||
}
|
||||
} else {
|
||||
if (isset($record)) {
|
||||
try {
|
||||
$record->setContent($data);
|
||||
|
@ -144,6 +149,7 @@ class Database
|
|||
}
|
||||
}
|
||||
$this->entityManager->persist($record);
|
||||
}
|
||||
if (!$bulkMode) {
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue