You are here

function commerce_payment_update_8207 in Commerce Core 8.2

Ensure new field indexes on the payment and payment method entities.

File

modules/payment/commerce_payment.install, line 153
Install, update and uninstall functions for the commerce_payment module.

Code

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

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

  // Regenerate entity type indexes.
  $definition_update_manager
    ->updateEntityType($entity_type);
  $entity_type = $entity_type_manager
    ->getDefinition('commerce_payment_method')
    ->setHandlerClass('storage_schema', CommerceContentEntityStorageSchema::class);
  $definition_update_manager
    ->updateEntityType($entity_type);
}