Skip to content

Commit

Permalink
Issue ec-europa#143: Set storage class for 'rdf_entity' in update hook.
Browse files Browse the repository at this point in the history
This prevents error in system_post_update_entity_revision_metadata_bc_cleanup() which runs after the update hooks.
  • Loading branch information
donquixote committed Dec 21, 2021
1 parent 411bfec commit 8302c12
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions rdf_entity.install
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Serialization\Yaml;
use Drupal\Core\Utility\UpdateException;
use Drupal\sparql_entity_storage\Entity\SparqlGraph;
use Drupal\sparql_entity_storage\Entity\SparqlMapping;
use Drupal\sparql_entity_storage\SparqlEntityStorage;
Expand Down Expand Up @@ -134,3 +135,17 @@ function rdf_entity_update_8004() {
}
}
}

/**
* Update storage class for 'rdf_entity' entity type.
*/
function rdf_entity_update_8005() {
$definition_update_manager = \Drupal::entityDefinitionUpdateManager();
/* @see \Drupal\rdf_entity\Entity\Rdf */
$entity_type = $definition_update_manager->getEntityType('rdf_entity');
if (!$entity_type) {
throw new UpdateException("Entity type 'rdf_entity' not found.");
}
$entity_type->setStorageClass(SparqlEntityStorage::class);
$definition_update_manager->updateEntityType($entity_type);
}

0 comments on commit 8302c12

Please sign in to comment.