πŸ‡ΊπŸ‡ΈUnited States @kjl

Account created on 29 July 2004, over 20 years ago
#

Recent comments

πŸ‡ΊπŸ‡ΈUnited States kjl

kjl β†’ created an issue.

πŸ‡ΊπŸ‡ΈUnited States kjl

If you want to test changing the commerce_order_load() Locking Mode in D7 without hacking core, you can do something like the following:

class ExampleExtender extends SelectQueryExtender {
  public function __toString() {
  $query = parent::__toString();
  $query .= ' ' LOCK IN SHARE MODE';
  return $query;
  }
}

function my_module_query_alter(QueryAlterableInterface &$query) {
  $tags = array_flip(array_keys($query->alterTags));
  if (isset($tags['commerce_order_load_multiple'])) { 
    $query->forUpdate(FALSE);
    $query = $query->extend('ExampleExtender');
  }
}

Note that assigning the extender result back to $query is required, as a new object is returned from extend().

Production build 0.71.5 2024