You are here

function commerce_license_update_8202 in Commerce License 8.2

Add the 'originating_order' field to 'commerce_license' entities.

File

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

Code

function commerce_license_update_8202() {
  $storage_definition = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Originating order'))
    ->setDescription(t('The order that originated the license creation.'))
    ->setSetting('target_type', 'commerce_order')
    ->setSetting('handler', 'default')
    ->setDisplayConfigurable('view', TRUE);
  $update_manager = \Drupal::entityDefinitionUpdateManager();
  $update_manager
    ->installFieldStorageDefinition('originating_order', 'commerce_license', 'commerce_license', $storage_definition);
}