14 use Psr\Log\LoggerInterface as Logger;
28 private $stockConfiguration;
34 private $storeManager;
62 $this->
map[
'qty'] = [
'main_table',
'qty',
'qty'];
71 [
'cp_table' => $this->
getTable(
'catalog_product_entity')],
72 'main_table.product_id = cp_table.entity_id',
127 $websiteId = $this->getStockConfiguration()->getDefaultScopeId();
129 [
'status_table' => $this->
getTable(
'cataloginventory_stock_status')],
130 'main_table.product_id=status_table.product_id' .
131 ' AND main_table.stock_id=status_table.stock_id' .
132 $this->connection->quoteInto(
133 ' AND status_table.website_id=?',
145 if ($isStockManagedInConfig) {
146 $this->
getSelect()->where(
'(manage_stock = 1 OR use_config_manage_stock = 1)');
158 $methods = [
'<' =>
'lt',
'>' =>
'gt',
'=' =>
'eq',
'<=' =>
'lteq',
'>=' =>
'gteq',
'<>' =>
'neq'];
159 if (!isset(
$methods[$comparisonMethod])) {
160 throw new \Magento\Framework\Exception\LocalizedException(
161 __(
'%1 is not a correct comparison method.', $comparisonMethod)
172 private function getStockConfiguration()
174 if ($this->stockConfiguration ===
null) {
176 ->get(\
Magento\CatalogInventory\Api\StockConfigurationInterface::class);
178 return $this->stockConfiguration;
map(CriteriaInterface $criteria)
mapWebsiteFilter($website)
addFieldToFilter($field, $condition=null)
mapManagedFilter($isStockManagedInConfig)
__construct(Logger $logger, FetchStrategyInterface $fetchStrategy, ObjectFactory $objectFactory, MapperFactory $mapperFactory, StoreManagerInterface $storeManager, Select $select=null)
mapStockStatus($storeId=null)
mapQtyFilter($comparisonMethod, $qty)
initResource($resourceInterface)
mapProductsFilter($products)