You are here

cer_commerce.module in Corresponding Entity References 7.3

File

extensions/cer_commerce/cer_commerce.module
View source
<?php

/**
 * Implements hook_cer_insert().
 */
function cer_commerce_cer_insert(CerPreset $preset) {

  // Prevents a race condition when deleting Commerce products which are referred to
  // by Product Reference fields managed by CER.
  if ($preset->wrapper->cer_right->chain
    ->value()
    ->end() instanceof CerCommerceProductReferenceField) {
    $preset->wrapper->cer_bidirectional
      ->set(FALSE);

    // Issue #2369863
    $preset->is_new = FALSE;
    $preset
      ->save();
    drupal_set_message(t('In order to prevent a race condition, bidirectionality has been disabled for this preset.'), 'warning');
  }
}

Functions

Namesort descending Description
cer_commerce_cer_insert Implements hook_cer_insert().