You are here

function commerce_order_update_8210 in Commerce Core 8.2

Ensure new field indexes on the order entity.

File

modules/order/commerce_order.install, line 215
Install, update and uninstall functions for the Order module.

Code

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

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

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