You are here

function commerce_payment_update_8202 in Commerce Core 8.2

Make payment_gateway and payment_method order fields optional.

File

modules/payment/commerce_payment.install, line 66
Install, update and uninstall functions for the commerce_payment module.

Code

function commerce_payment_update_8202() {
  $entity_definition_update = \Drupal::entityDefinitionUpdateManager();
  $field_definition = $entity_definition_update
    ->getFieldStorageDefinition('payment_gateway', 'commerce_order');
  $field_definition
    ->setRequired(FALSE);
  $entity_definition_update
    ->updateFieldStorageDefinition($field_definition);
  $field_definition = $entity_definition_update
    ->getFieldStorageDefinition('payment_method', 'commerce_order');
  $field_definition
    ->setRequired(FALSE);
  $entity_definition_update
    ->updateFieldStorageDefinition($field_definition);
}