You are here

function commerce_license_update_8201 in Commerce License 8.2

Update entity keys for licenses.

File

./commerce_license.install, line 13
Contains install and update functions for Commerce License.

Code

function commerce_license_update_8201() {
  $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  $uid_storage_definition = $definition_update_manager
    ->getFieldStorageDefinition('uid', 'commerce_license');
  $entity_type = $definition_update_manager
    ->getEntityType('commerce_license');
  $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);
}