You are here

public function CommerceLocalStockTransactionSubscriber::onTransactionInsert in Commerce Stock 8

Invalidate the cache for the purchased entity.

Parameters

\Drupal\commerce_stock_local\Event\LocalStockTransactionEvent $event: The event.

File

modules/local_storage/src/EventSubscriber/CommerceLocalStockTransactionSubscriber.php, line 49

Class

CommerceLocalStockTransactionSubscriber
Test class to test the commerce_stock transaction events.

Namespace

Drupal\commerce_stock_local\EventSubscriber

Code

public function onTransactionInsert(LocalStockTransactionEvent $event) {
  $purchasableEntity = $event
    ->getEntity();
  $this->cacheTagsInvalidator
    ->invalidateTags($purchasableEntity
    ->getCacheTagsToInvalidate());
}