You are here

function commerce_product_update_8206 in Commerce Core 8.2

Set the 'published' entity key for variations.

File

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

Code

function commerce_product_update_8206() {
  $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  $entity_type = $definition_update_manager
    ->getEntityType('commerce_product_variation');
  $keys = $entity_type
    ->getKeys();
  $keys['published'] = 'status';
  unset($keys['status']);
  $entity_type
    ->set('entity_keys', $keys);
  $definition_update_manager
    ->updateEntityType($entity_type);
}