Loads list of low stock state products

@param array $aBasketContents product ids array
498758
public function loadStockRemindProducts($aBasketContents)
    {
        if (is_array($aBasketContents) && count($aBasketContents)) {
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            foreach ($aBasketContents as $oBasketItem) {
                $aArtIds[] = $oDb->quote($oBasketItem->getProductId());
            }

            $oBaseObject = $this->getBaseObject();

            $sFieldNames = $oBaseObject->getSelectFields();
            $sTable = $oBaseObject->getViewName();

            // fetching actual db stock state and reminder status
            $sQ = "select {$sFieldNames} from {$sTable} where {$sTable}.oxid in ( " . implode(",", $aArtIds) . " ) and
                          oxremindactive = '1' and oxstock <= oxremindamount";
            $this->selectString($sQ);

            // updating stock reminder state
            if ($this->count()) {
                $sQ = "update {$sTable} set oxremindactive = '2' where {$sTable}.oxid in ( " . implode(",", $aArtIds) . " ) and
                              oxremindactive = '1' and oxstock <= oxremindamount";
                $oDb->execute($sQ);
            }
        }
    }
485610
protected function parseStates(array $states)
    {
        $newStates = array();
        foreach ($states as $key => $state) {
            if (null === $state) {
                $newStates[] = $key;
            } elseif (self::CFG_STATE_DISABLE !== $state) {
                $newStates[] = $state;
            } elseif (null !== $index = array_search($key, $newStates)) {
                unset($newStates[$index]);
            }
        }

        return $newStates;
    }
1367942
public function load(array $pArgs = array())
    {
        $select = new Select($this->_dbContainer);
        /*$select->addFields(array(
            ItemInterface::IDFIELD => true
        ));*/

        if (isset($pArgs[DbInterface::FILTER_LIMIT])) {
            $select->limit($pArgs[DbInterface::FILTER_LIMIT]);
        }

        if (isset($pArgs[DbInterface::FILTER_ORDER])) {
            $select->addOrder($pArgs[DbInterface::FILTER_ORDER]);
        } else {
            $select->addOrder(array(
                $this->_dbContainer . ItemInterface::PREFIX_SEPARATOR . ItemInterface::IDFIELD => Db::ORDER_DESC
            ));
        }

        if (isset($pArgs[DbInterface::FILTER_CONDITIONS]) and $pArgs[DbInterface::FILTER_CONDITIONS] instanceof Conditions) {
            $select->loadConditions($pArgs[DbInterface::FILTER_CONDITIONS]);
        }

        $select->find();

        $this->_count  = $select->count();
        $this->_select = $select;
        $this->_fetch();

        return $this;
    }
722451
public function setStockTickers(array $stockTickers)
    {
        if ($stockTickers && count($stockTickers) > 5) {
            throw new Exception\GoogleNewsUrlException(
                'The stock tickers are limited to 5. See https://support.google.com/webmasters/answer/74288?hl=en&ref_topic=10078'
            );
        }
        $this->stockTickers = $stockTickers;

        return $this;
    }
1269246
public function setContents(array $aContents) {
		$this->aContents = array();
		foreach ($aContents as $content) {
			$this->append($content);
		}
	}
710406
public function loadOrderArticles($aOrders)
    {
        if (!count($aOrders)) {
            $this->clear();

            return;
        }

        foreach ($aOrders as $iKey => $oOrder) {
            $aOrdersIds[] = $oOrder->getId();
        }

        $oBaseObject = $this->getBaseObject();
        $sArticleTable = $oBaseObject->getViewName();
        $sArticleFields = $oBaseObject->getSelectFields();
        $sArticleFields = str_replace("`$sArticleTable`.`oxid`", "`oxorderarticles`.`oxartid` AS `oxid`", $sArticleFields);

        $sSelect = "SELECT $sArticleFields FROM oxorderarticles ";
        $sSelect .= "left join $sArticleTable on oxorderarticles.oxartid = $sArticleTable.oxid ";
        $sSelect .= "WHERE oxorderarticles.oxorderid IN ( '" . implode("','", $aOrdersIds) . "' ) ";
        $sSelect .= "order by $sArticleTable.oxid ";

        $this->selectString($sSelect);

        // not active or not available products must not have button "tobasket"
        $sNow = date('Y-m-d H:i:s');
        foreach ($this as $oArticle) {
            if (!$oArticle->oxarticles__oxactive->value &&
                ($oArticle->oxarticles__oxactivefrom->value > $sNow ||
                 $oArticle->oxarticles__oxactiveto->value < $sNow
                )
            ) {
                $oArticle->setBuyableState(false);
            }
        }
    }
97271
private function loadResources()
    {
        if ($this->class !== null && $this->classFilterSet === false) {
            $this->addClassFilter();
        }

        /** @var common_persistence_SqlPersistence $persistence */
        $persistence = $this->getModel()->getPersistence();
        $platform = $persistence->getPlatForm();
        $query = $platform->getQueryBuilder()
            ->select('*')
            ->from('statements')
            ->andWhere('id > ' . $this->lastId)
            ->orderBy('id');

        if ($this->cacheSize > 0) {
            $query->setMaxResults($this->cacheSize);
        }

        $query = $this->filter->applyFilters($query);
        $results = $query->execute();

        if ($this->cacheSize > 0) {
            $this->endOfClass = $results->rowCount() < $this->cacheSize;
        }

        foreach ($results->fetchAll() as $result) {
            $this->resources[] = $result;
            $this->lastId = $result['id'] > $this->lastId ? $result['id'] : $this->lastId;
        }
    }
82206
public function loadProductSaleElements(FormEvent $event)
    {
        $productSaleElementIds = array();
        $data = array();

        foreach ($event->getData()["pse"] as $entry) {
            $productSaleElementIds[$entry["id"]] = $entry;
        }

        $productSaleElements = ProductSaleElementsQuery::create()
            ->findPks(array_keys($productSaleElementIds))
        ;

        /** @var ProductSaleElements $productSaleElement */
        foreach ($productSaleElements as $productSaleElement) {
            $product = $productSaleElement->getProduct();

            list($price, $salePrice, $currencyId, $fromDefaultCurrency) = $this->retrievePrices($productSaleElement);

            $data["pse"][$productSaleElement->getId()] = array_merge(
                [
                    "id" => $productSaleElement->getId(),
                    "reference" => $productSaleElement->getRef(),
                    "tax_rule_id" => $product->getTaxRuleId(),
                    "ean_code" => $productSaleElement->getEanCode(),
                    "onsale" => $productSaleElement->getPromo(),
                    "isdefault" => $productSaleElement->getIsDefault(),
                    "isnew" => $productSaleElement->getNewness(),
                    "quantity" => $productSaleElement->getQuantity(),
                    "weight" => $productSaleElement->getWeight(),
                    "price" => $price,
                    "sale_price" => $salePrice,
                    "currency_id" => $currencyId,
                    "use_exchange_rate" => $fromDefaultCurrency
                ],
                $productSaleElementIds[$productSaleElement->getId()]
            );
        }

        $event->setData($data);
    }
351328
protected function loadSomeFixtures($selectedFixtures)
    {
        $fixtures = glob("{$this->config['location']}/*.php");

        foreach ($fixtures as $fixture) {
            $tableName = basename($fixture, '.php');

            if (in_array($tableName, $selectedFixtures)) {
                $this->loadFixture($fixture);
            }
        }
    }
257854
public function load(array $hooks)
    {
        if (empty($hooks)) {
            return;
        }

        foreach ($hooks as $hook) {
            $this->app->registerHook($hook);
        }
    }
759908
public function loadIndexedList()
    {
        if ($this->stmt === null) {
            return null;
        }

        $indexedList = array();
        while ($row = $this->stmt->fetch(\PDO::FETCH_NUM)) {
            $indexedList[] = $row;
        }
        return $indexedList;
    }
1232064
private function load(array $entities, callable $queryBuilderCallback = null)
    {
        foreach ($entities as $key => $entity) {
            $hash = spl_object_hash($entity);

            if (!empty($queryBuilderCallback)) {
                /** @var callable|object $queryBuilderCallback */
                $hash .= spl_object_hash($queryBuilderCallback);
            }
            if (isset($this->processedHashes[$hash])) {
                unset($entities[$key]);

                continue;
            }

            $this->processedHashes[$hash] = true;

            $entityClass = ClassUtils::getClass($entity);

            if (!$this->customObjectsLoadable($entityClass)) {
                $message = sprintf(
                    'Class "%s" must be annotated with "%s" annotation in order to load custom objects.',
                    $entityClass,
                    CustomObject::class
                );

                throw new CustomObjectException($message);
            }
        }

        $customEntitiesMap = $this->buildCustomEntitiesMap($entities);

        $queriesMap = $this->buildQueriesMap($customEntitiesMap);

        $customEntities = $this->fetchCustomEntities($queriesMap, $queryBuilderCallback);

        $this->setCustomEntities($entities, $customEntities, $customEntitiesMap);
    }
80472
public function loadInventoryData($storeId, $productIds)
    {
        $websiteId = $this->getWebsiteId($storeId);
        $stockId   = $this->getStockId($websiteId);

        $select = $this->getConnection()->select()
            ->from(['ciss' => $this->getTable('cataloginventory_stock_status')], ['product_id', 'stock_status', 'qty'])
            ->where('ciss.stock_id = ?', $stockId)
            ->where('ciss.website_id = ?', $this->stockConfiguration->getDefaultScopeId())
            ->where('ciss.product_id IN(?)', $productIds);

        return $this->getConnection()->fetchAll($select);
    }
602632
private function loadRelations(
        LoadingContext $context,
        array $rows,
        array $objects,
        array &$objectProperties
    ) {
        $isLazyLoadingEnabled = $this->definition->isLazyLoadingEnabled();

        foreach ($this->definition->getToOneRelationMappings() as $relationMapping) {
            $relation = $relationMapping->getRelation();
            $accessor = $relationMapping->getAccessor();

            $map       = new ParentChildMap($this->primaryKeyColumnName);
            $rowKeyMap = new \SplObjectStorage();

            foreach ($rows as $key => $row) {
                $map->add($row, null);
                $rowKeyMap[$row] = $key;
            }

            $relation->load($context, $map);

            foreach ($map->getItems() as $item) {
                $objectKey = $rowKeyMap[$item->getParent()];
                $accessor->set($objects[$objectKey], $objectProperties[$objectKey], $item->getChild());
            }
        }

        foreach ($this->definition->getToManyRelationMappings() as $relationMapping) {

            $relation = $relationMapping->getRelation();
            $accessor = $relationMapping->getAccessor();

            $map       = new ParentChildrenMap($this->primaryKeyColumnName);
            $rowKeyMap = new \SplObjectStorage();

            foreach ($rows as $key => $row) {
                $map->add($row, []);
                $rowKeyMap[$row] = $key;
            }

            $hasLoaded = false;

            if (!$isLazyLoadingEnabled) {
                $relation->load($context, $map);
                $hasLoaded = true;
            }

            foreach ($map->getItems() as $item) {
                $objectKey = $rowKeyMap[$item->getParent()];
                $object    = $objects[$objectKey];

                if ($hasLoaded) {
                    $collection = $relation->buildCollection($item->getChildren());
                } else {
                    $collection = LazyCollectionFactory::from(
                        $relation->buildCollection([]),
                        function () use (&$hasLoaded, $relation, $context, $map, $item) {
                            if (!$hasLoaded) {
                                $relation->load($context, $map);
                                $hasLoaded = true;
                            }

                            return $item->getChildren();
                        }
                    );

                    $collection->appendLazyMetadata([
                        'parent'   => $object,
                        'relation' => $relation,
                    ]);
                }

                $accessor->set($object, $objectProperties[$objectKey], $collection);
            }

            unset($hasLoaded);
        }
    }
704362
public function loadInventoryData($storeId, $productIds)
    {
        $websiteId = $this->getWebsiteId($storeId);
        $stockId   = $this->getStockId($websiteId);
        $tableName = $this->stockIndexTableProvider->execute($stockId);

        $select = $this->getConnection()->select()
            ->from(['product' => $this->getTable('catalog_product_entity')], [])
            ->join(
                ['stock_index' => $tableName],
                'product.sku = stock_index.' . IndexStructure::SKU,
                [
                    'product_id'    => 'product.entity_id',
                    'stock_status'  => 'stock_index.' . IndexStructure::IS_SALABLE,
                    'qty'           => 'stock_index.' . IndexStructure::QUANTITY,
                ]
            )
            ->where('product.entity_id IN (?)', $productIds)
            ->group('product.entity_id');

        return $this->getConnection()->fetchAll($select);
    }
334102
public function loadBargain()
    {
        if (($this->_aChannel = $this->_loadFromCache(self::RSS_BARGAIN))) {
            return;
        }

        $oArtList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class);
        $oArtList->loadActionArticles('OXBARGAIN', \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iRssItemsCount'));

        $oLang = Registry::getLang();
        $this->_loadData(
            self::RSS_BARGAIN,
            $this->getBargainTitle(),
            $oLang->translateString('BARGAIN_PRODUCTS', $oLang->getBaseLanguage()),
            $this->_getArticleItems($oArtList),
            $this->getBargainUrl()
        );
    }
1009244
public function loadObjectList($params=array()) {

		$this->openConnection();
		
		$ret = NULL;
		
		try {

			$stat = $this->handler->prepare($this->query);
			$stat->execute((array)$params);
			$ret = $stat->fetchAll(\PDO::FETCH_OBJ);
			
			// logger
			$this->logParamQuery($this->query, count($ret), $params);

		} catch (\PDOException $e) {

			$this->handleException($e, $params);
		
		}
		
		$stat->closeCursor();

		return $ret;
		
	}