You are here

class DefaultStoreResolver in Commerce Core 8.2

Returns the default store, if known.

Hierarchy

Expanded class hierarchy of DefaultStoreResolver

1 file declares its use of DefaultStoreResolver
DefaultStoreResolverTest.php in modules/store/tests/src/Unit/Resolver/DefaultStoreResolverTest.php
1 string reference to 'DefaultStoreResolver'
commerce_store.services.yml in modules/store/commerce_store.services.yml
modules/store/commerce_store.services.yml
1 service uses DefaultStoreResolver
commerce_store.default_store_resolver in modules/store/commerce_store.services.yml
Drupal\commerce_store\Resolver\DefaultStoreResolver

File

modules/store/src/Resolver/DefaultStoreResolver.php, line 10

Namespace

Drupal\commerce_store\Resolver
View source
class DefaultStoreResolver implements StoreResolverInterface {

  /**
   * The store storage.
   *
   * @var \Drupal\commerce_store\StoreStorageInterface
   */
  protected $storage;

  /**
   * Constructs a new DefaultStoreResolver object.
   *
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager.
   */
  public function __construct(EntityTypeManagerInterface $entity_type_manager) {
    $this->storage = $entity_type_manager
      ->getStorage('commerce_store');
  }

  /**
   * {@inheritdoc}
   */
  public function resolve() {
    return $this->storage
      ->loadDefault();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DefaultStoreResolver::$storage protected property The store storage.
DefaultStoreResolver::resolve public function Resolves the store. Overrides StoreResolverInterface::resolve
DefaultStoreResolver::__construct public function Constructs a new DefaultStoreResolver object.