You are here

class ProductBundleStockProxyService in Commerce Product Bundle 8

A stock service for always in stock products.

Hierarchy

Expanded class hierarchy of ProductBundleStockProxyService

1 string reference to 'ProductBundleStockProxyService'
commerce_product_bundle_stock.services.yml in modules/commerce_product_bundle_stock/commerce_product_bundle_stock.services.yml
modules/commerce_product_bundle_stock/commerce_product_bundle_stock.services.yml
1 service uses ProductBundleStockProxyService
commerce_product_bundle.stock_proxy_service in modules/commerce_product_bundle_stock/commerce_product_bundle_stock.services.yml
Drupal\commerce_product_bundle_stock\ProductBundleStockProxyService

File

modules/commerce_product_bundle_stock/src/ProductBundleStockProxyService.php, line 11

Namespace

Drupal\commerce_product_bundle_stock
View source
class ProductBundleStockProxyService implements StockServiceInterface {

  /**
   * The stock checker.
   *
   * @var \Drupal\commerce_stock\StockCheckInterface
   */
  protected $stockChecker;

  /**
   * The stock updater.
   *
   * @var \Drupal\commerce_stock\StockUpdateInterface
   */
  protected $stockUpdater;

  /**
   * The stock service configuration.
   *
   * @var \Drupal\commerce_stock\StockServiceConfigInterface
   */
  protected $stockServiceConfig;

  /**
   * Constructs a new ProductBundleStockProxyService object.
   */
  public function __construct() {

    // The service manager is not injected into the constructor because the
    // it needs to load before being used here.
    $stock_service_manager = \Drupal::service('commerce_stock.service_manager');
    $this->stockChecker = new ProductBundleStockProxy($stock_service_manager);
    $this->stockUpdater = $this->stockChecker;
    $this->stockServiceConfig = new StockServiceConfig($this->stockChecker);
  }

  /**
   * {@inheritdoc}
   */
  public function getName() {
    return 'Product bundle stock proxy service';
  }

  /**
   * {@inheritdoc}
   */
  public function getId() {
    return 'commerce_product_bundle_stock';
  }

  /**
   * {@inheritdoc}
   */
  public function getStockChecker() {
    return $this->stockChecker;
  }

  /**
   * {@inheritdoc}
   */
  public function getStockUpdater() {
    return $this->stockUpdater;
  }

  /**
   * {@inheritdoc}
   */
  public function getConfiguration() {
    return $this->stockServiceConfig;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ProductBundleStockProxyService::$stockChecker protected property The stock checker.
ProductBundleStockProxyService::$stockServiceConfig protected property The stock service configuration.
ProductBundleStockProxyService::$stockUpdater protected property The stock updater.
ProductBundleStockProxyService::getConfiguration public function Gets the stock Configuration. Overrides StockServiceInterface::getConfiguration
ProductBundleStockProxyService::getId public function Gets the id of the service. Overrides StockServiceInterface::getId
ProductBundleStockProxyService::getName public function Gets the name of the service. Overrides StockServiceInterface::getName
ProductBundleStockProxyService::getStockChecker public function Gets the stock checker. Overrides StockServiceInterface::getStockChecker
ProductBundleStockProxyService::getStockUpdater public function Gets the stock updater. Overrides StockServiceInterface::getStockUpdater
ProductBundleStockProxyService::__construct public function Constructs a new ProductBundleStockProxyService object.