Skip to content

Indexer's automatice versioning rework

Compare
Choose a tag to compare
@zozlak zozlak released this 12 Feb 14:28
· 1 commit to master since this release

Previously the metadata handling on an automatic new version creation was hardcoded (and configurable only with a bool $pidPass parameter). Now the Indexer::setVersioning(), File::upload() and File::uploadAsync() take two callables with signatures

`function (
    rdfInterface\DatasetNodeInterface $oldMeta,
    acdhOeaw\arche\lib\Schema $repoSchema
): array{rdfInterface\DatasetNodeInterface $oldMeta, rdfInterface\DatasetNodeInterface $newMeta}

and

function (
    acdhOeaw\arche\lib\RepoResource $old,
    acdhOeaw\arche\lib\RepoResource $new
): void

The first one should generate old and new version metadata according to a given repository's business logic.
The second one is responsible for doing any metadata adjustments which require both old and new version resource to exist (e.g. updating references which pointed to the old version to point to the new one).

A sample implementation of such a handler can be found in the tests/IndexerTest.php::testNewVersionCreation()