- πΊπΈ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().