Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
StockItemCriteria.php
Go to the documentation of this file.
1 <?php
8 
11 
16 {
20  public function __construct($mapper = '')
21  {
22  $this->mapperInterfaceName = $mapper ?: StockItemCriteriaMapper::class;
23  $this->data['initial_condition'] = [true];
24  }
25 
29  public function setStockStatus($storeId = null)
30  {
31  $this->data['stock_status'] = func_get_args();
32  return true;
33  }
34 
38  public function setStockFilter($stock)
39  {
40  $this->data['stock_filter'] = [$stock];
41  return true;
42  }
43 
47  public function setScopeFilter($scope)
48  {
49  $this->data['website_filter'] = [$scope];
50  return true;
51  }
52 
56  public function setProductsFilter($products)
57  {
58  $this->data['products_filter'] = [$products];
59  return true;
60  }
61 
65  public function setManagedFilter($isStockManagedInConfig)
66  {
67  $this->data['managed_filter'] = [$isStockManagedInConfig];
68  return true;
69  }
70 
74  public function setQtyFilter($comparisonMethod, $qty)
75  {
76  $this->data['qty_filter'] = [$comparisonMethod, $qty];
77  return true;
78  }
79 
86  public function addCriteria(\Magento\CatalogInventory\Api\StockItemCriteriaInterface $criteria)
87  {
88  $this->data[self::PART_CRITERIA_LIST]['list'][] = $criteria;
89  return true;
90  }
91 }
$stock
addCriteria(\Magento\CatalogInventory\Api\StockItemCriteriaInterface $criteria)