class LocalStockServiceConfig in Commerce Stock 8
The local stock service configuration class.
Hierarchy
- class \Drupal\commerce_stock_local\LocalStockServiceConfig implements StockServiceConfigInterface
Expanded class hierarchy of LocalStockServiceConfig
1 string reference to 'LocalStockServiceConfig'
- commerce_stock_local.services.yml in modules/
local_storage/ commerce_stock_local.services.yml - modules/local_storage/commerce_stock_local.services.yml
1 service uses LocalStockServiceConfig
File
- modules/
local_storage/ src/ LocalStockServiceConfig.php, line 13
Namespace
Drupal\commerce_stock_localView source
class LocalStockServiceConfig implements StockServiceConfigInterface {
/**
* The stock location storage.
*
* @var \Drupal\commerce_stock_local\StockLocationStorageInterface
*/
protected $storage;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs the local stock service config.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
$this->storage = $entity_type_manager
->getStorage('commerce_stock_location');
}
/**
* {@inheritdoc}
*/
public function getTransactionLocation(Context $context, PurchasableEntityInterface $entity, $quantity) {
return $this->storage
->getTransactionLocation($context, $entity);
}
/**
* {@inheritdoc}
*/
public function getAvailabilityLocations(Context $context, PurchasableEntityInterface $entity) {
return $this->storage
->loadInContext($context, $entity);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LocalStockServiceConfig:: |
protected | property | The entity type manager. | |
LocalStockServiceConfig:: |
protected | property | The stock location storage. | |
LocalStockServiceConfig:: |
public | function |
Get locations holding stock. Overrides StockServiceConfigInterface:: |
|
LocalStockServiceConfig:: |
public | function |
Get the location for automatic stock allocation. Overrides StockServiceConfigInterface:: |
|
LocalStockServiceConfig:: |
public | function | Constructs the local stock service config. |