You are here

function eck_update_8006 in Entity Construction Kit (ECK) 8

Set the 'published' entity key.

File

./eck.install, line 103

Code

function eck_update_8006() {
  $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  foreach (\Drupal::entityTypeManager()
    ->getStorage('eck_entity_type')
    ->loadMultiple() as $entity_type) {
    $entity_type = $definition_update_manager
      ->getEntityType($entity_type
      ->id());
    $keys = $entity_type
      ->getKeys();
    $keys['published'] = 'status';
    $entity_type
      ->set('entity_keys', $keys);
    $definition_update_manager
      ->updateEntityType($entity_type);
  }
}