diff --git a/modules/metastore/src/EventSubscriber/MetastoreSubscriber.php b/modules/metastore/src/EventSubscriber/MetastoreSubscriber.php index 50cc57f727..0481298af2 100644 --- a/modules/metastore/src/EventSubscriber/MetastoreSubscriber.php +++ b/modules/metastore/src/EventSubscriber/MetastoreSubscriber.php @@ -75,7 +75,7 @@ public static function getSubscribedEvents() { public function cleanResourceMapperTable(Event $event) { $distribution_id = $event->getData(); // Use the metastore service to build a distribution object. - $distribution = $this->service->get('distribution', $distribution_id); + $distribution = $this->service->get('distribution', $distribution_id, FALSE); // Attempt to extract all resources for the given distribution. $resources = $distribution->{'$.data["%Ref:downloadURL"]..data'} ?? []; diff --git a/modules/metastore/src/MetastoreService.php b/modules/metastore/src/MetastoreService.php index 13c9995260..030f5671e8 100644 --- a/modules/metastore/src/MetastoreService.php +++ b/modules/metastore/src/MetastoreService.php @@ -233,12 +233,14 @@ public function isPublished(string $schema_id, string $identifier): bool { * The {schema_id} slug from the HTTP request. * @param string $identifier * Identifier. + * @param bool $published + * If true, retrieve only published revision. * * @return \RootedData\RootedJsonData * The json data. */ - public function get(string $schema_id, string $identifier): RootedJsonData { - $json_string = $this->getStorage($schema_id)->retrieve($identifier, TRUE); + public function get(string $schema_id, string $identifier, bool $published = TRUE): RootedJsonData { + $json_string = $this->getStorage($schema_id)->retrieve($identifier, $published); $data = $this->validMetadataFactory->get($json_string, $schema_id); $data = $this->dispatchEvent(self::EVENT_DATA_GET, $data);