You are here

function commerce_wishlist_update_8306 in Commerce Wishlist 8.3

Add 'purchases' field to commerce_wishlist_item entities.

File

./commerce_wishlist.install, line 171
Contains install and update functions for Commerce Wishlist.

Code

function commerce_wishlist_update_8306() {
  \Drupal::service('plugin.manager.field.field_type')
    ->clearCachedDefinitions();
  $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  $storage_definition = BaseFieldDefinition::create('commerce_wishlist_purchase')
    ->setLabel(t('Purchases'))
    ->setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED);
  $definition_update_manager
    ->installFieldStorageDefinition('purchases', 'commerce_wishlist_item', 'commerce_wishlist', $storage_definition);
}