You are here

function opigno_learning_path_update_8004 in Opigno Learning path 8

Creates database table for Latest Activity entity type.

File

./opigno_learning_path.install, line 42
Install, update and uninstall functions for the module.

Code

function opigno_learning_path_update_8004() {
  $database = \Drupal::database();
  if (!$database
    ->schema()
    ->tableExists('opigno_latest_group_activity')) {
    $entityTypeManager = \Drupal::entityTypeManager();
    $entityTypeManager
      ->clearCachedDefinitions();
    $definition = $entityTypeManager
      ->getDefinition('opigno_latest_group_activity');
    \Drupal::entityDefinitionUpdateManager()
      ->installEntityType($definition);
  }
  else {
    return 'Latest Activity entity already exists';
  }
  return NULL;
}