class DefaultStoreResolver in Commerce Core 8.2
Returns the default store, if known.
Hierarchy
- class \Drupal\commerce_store\Resolver\DefaultStoreResolver implements StoreResolverInterface
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
File
- modules/
store/ src/ Resolver/ DefaultStoreResolver.php, line 10
Namespace
Drupal\commerce_store\ResolverView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DefaultStoreResolver:: |
protected | property | The store storage. | |
DefaultStoreResolver:: |
public | function |
Resolves the store. Overrides StoreResolverInterface:: |
|
DefaultStoreResolver:: |
public | function | Constructs a new DefaultStoreResolver object. |