You are here

public function CurrentStore::getStore in Commerce Core 8.2

Gets the active store for the current request.

Return value

\Drupal\commerce_store\Entity\StoreInterface The active store.

Overrides CurrentStoreInterface::getStore

File

modules/store/src/CurrentStore.php, line 62

Class

CurrentStore
Holds a reference to the current store, resolved on demand.

Namespace

Drupal\commerce_store

Code

public function getStore() {
  $request = $this->requestStack
    ->getCurrentRequest();
  if (!$this->stores
    ->contains($request)) {
    $this->stores[$request] = $this->chainResolver
      ->resolve();
  }
  return $this->stores[$request];
}