You are here

function commerce_recurring_update_8105 in Commerce Recurring Framework 8

Update entity keys for subscriptions.

File

./commerce_recurring.install, line 125
Install, update and uninstall functions for the commerce_recurring module.

Code

function commerce_recurring_update_8105() {
  $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  $uid_storage_definition = $definition_update_manager
    ->getFieldStorageDefinition('uid', 'commerce_subscription');
  $entity_type = $definition_update_manager
    ->getEntityType('commerce_subscription');
  $keys = $entity_type
    ->getKeys();
  $keys['owner'] = 'uid';
  $entity_type
    ->set('entity_keys', $keys);
  $definition_update_manager
    ->updateEntityType($entity_type);
  $definition_update_manager
    ->updateFieldStorageDefinition($uid_storage_definition);
}