You are here

function commerce_product_update_8211 in Commerce Core 8.2

Ensure new field indexes on the product variation entity.

File

modules/product/commerce_product.install, line 275
Install, update and uninstall functions for the Product module.

Code

function commerce_product_update_8211() {
  $entity_type_manager = \Drupal::entityTypeManager();
  $definition_update_manager = \Drupal::entityDefinitionUpdateManager();

  // Get the current product variation entity type definition, ensure the
  // storage schema class is set.
  $entity_type = $entity_type_manager
    ->getDefinition('commerce_product_variation')
    ->setHandlerClass('storage_schema', CommerceContentEntityStorageSchema::class);

  // Regenerate entity type indexes.
  $definition_update_manager
    ->updateEntityType($entity_type);
}