Get data for a list of categories in a store id.
If the product list ids is null, all categories data will be loaded.

@param integer    $storeId     Store id.
@param array|null $categoryIds List of category ids.

@return \Traversable
337174
public function rebuildStoreIndex($storeId, $categoryIds = null)
    {
        $lastCategoryId = 0;

        do {
            $categories = $this->getSearchableCategories($storeId, $categoryIds, $lastCategoryId);

            foreach ($categories as $categoryData) {
                $lastCategoryId = (int) $categoryData['entity_id'];
                yield $lastCategoryId => $categoryData;
            }
        } while (!empty($categories));
    }
1161766
private function initStores($storeIds)
    {
        if (!is_array($storeIds)) {
            $storeIds = explode(',', $storeIds);
        }

        $availableStores = $this->storeManager->getStores(true);

        foreach ($availableStores as $availableStore) {
            if (in_array($availableStore->getId(), $storeIds)) {
                $this->storeIds[$availableStore->getId()] = $availableStore;
            }
        }

        return $this;
    }
380573
public function getProductByIdAndStore($id, $storeId)
    {
        $product = $this->productFactory->create()
            ->getCollection()
            ->addIdFilter($id)
            ->setStoreId($storeId)
            ->addAttributeToSelect(
                ['product_url', 'name', 'store_id', 'small_image']
            )
            ->setPage(1, 1);

        return $product->getFirstItem();
    }
1202084
private function loadChildAttributes(int $storeId)
    {
        if ($this->childEntities->count() === 0) {
            return;
        }

        $iterator = $this->eavIteratorFactory->create(['entityCode' => Product::ENTITY, 'attributes' => []]);
        $iterator->setEntityIds($this->childEntities->getIds());
        $iterator->setStoreId($storeId);
        $this->iteratorInitializer->initializeAttributes($iterator);

        foreach ($iterator as $childData) {
            $childId = (int) $childData['entity_id'];
            $childEntity = $this->childEntities->get($childId);
            $childEntity->setFromArray($childData);
        }
    }
810617
protected function load_category($categoryid) {
        global $DB;
        $category = $DB->get_record('course_categories', array('id' => $categoryid));
        if (!$category) {
            throw new moodle_exception('unknowncategory');
        }
        $this->_categories[$category->id] = $category;
        $parentcategoryids = explode('/', trim($category->path, '/'));
        array_pop($parentcategoryids);
        foreach (array_reverse($parentcategoryids) as $catid) {
            $this->_categories[$catid] = null;
        }
    }
522141
public function fetchData($storeId = Store::DEFAULT_STORE_ID, $categoryIds = [])
    {
        $connection = $this->getConnection('read');
        $table = $this->getTable('url_rewrite');
        $select = $connection
            ->select()
            ->from($table, ['entity_id', 'request_path'])
            ->where('entity_type = ?', 'category')
            ->where('redirect_type = ?', 0)
            ->where('store_id = ?', $storeId)
            ->where('entity_id IN (' . implode(',', $categoryIds) . ')');

        return $connection->fetchPairs($select);
    }
439182
public function addData($storeId, array $indexData)
    {
        $categoryData = $this->resourceModel->loadCategoryData($storeId, array_keys($indexData));

        foreach ($categoryData as $categoryDataRow) {
            $productId = (int) $categoryDataRow['product_id'];
            unset($categoryDataRow['product_id']);

            $categoryDataRow = array_merge(
                $categoryDataRow,
                [
                    'category_id' => (int) $categoryDataRow['category_id'],
                    'is_parent'   => (bool) $categoryDataRow['is_parent'],
                    'name'        => (string) $categoryDataRow['name'],
                ]
            );

            if (isset($categoryDataRow['position']) && $categoryDataRow['position'] !== null) {
                $categoryDataRow['position'] = (int) $categoryDataRow['position'];
            }

            if (isset($categoryDataRow['is_blacklisted'])) {
                $categoryDataRow['is_blacklisted'] = (bool) $categoryDataRow['is_blacklisted'];
            }

            $indexData[$productId]['category'][] = array_filter($categoryDataRow);
        }

        return $indexData;
    }
369498
public function getCdnUrl($storeId = null)
    {
        //Check for sandbox mode
        if ($this->isSandboxModeSet($storeId)) {
            return self::CDN_URL_SANDBOX;
        } else {
            return self::CDN_URL_PRODUCTION;
        }
    }
131976
public function getAccountData($storeId = null)
    {
        $url = $this->_getAdyenUrls($storeId);
        $wsUsername = $this->getConfigDataWsUserName($storeId);
        $wsPassword = $this->getConfigDataWsPassword($storeId);
        $account = array(
            'url' => $url,
            'login' => $wsUsername,
            'password' => $wsPassword
        );
        return $account;
    }
162653
private function getSearchableProducts($storeId, $productIds = null, $fromId = 0, $limit = 10000)
    {
        return $this->resourceModel->getSearchableProducts($storeId, $productIds, $fromId, $limit);
    }
1045564
protected function getTree($storeIds)
    {
        $filter = implode(',', $storeIds);
        if (isset($this->storeTrees[$filter])) {
            return $this->storeTrees[$filter];
        }

        $data = [];
        $stores = $this->storeManager->getStores(true);
        foreach ($stores as $store) {
            if (in_array($store->getId(), $storeIds)) {
                $data[$store->getId()] = $this->getStoreOptions($store);
            } elseif ($filter == 0) {
                $data[$store->getId()] = $this->getStoreOptions($store);
            }
        }

        $this->storeTrees[$filter] = $data;

        return $this->storeTrees[$filter];
    }
34177
public function loadChildrens($productIds, $storeId)
    {
        $children = [];

        foreach ($this->catalogProductType->getCompositeTypes() as $productTypeId) {
            $typeInstance = $this->getProductTypeInstance($productTypeId);
            $relation = $typeInstance->getRelationInfo();

            if ($relation->getTable() && $relation->getParentFieldName() && $relation->getChildFieldName()) {
                $select = $this->getRelationQuery($relation, $productIds, $storeId);
                $data   = $this->getConnection()->fetchAll($select);

                foreach ($data as $relationRow) {
                    $parentId = (int) $relationRow['parent_id'];
                    $childId  = (int) $relationRow['child_id'];
                    $sku      = (string) $relationRow['sku'];
                    $configurableAttributes = array_filter(explode(',', $relationRow["configurable_attributes"]));
                    $children[$childId][] = [
                        "parent_id"               => $parentId,
                        "configurable_attributes" => $configurableAttributes,
                        "sku"                     => $sku,
                    ];
                }
            }
        }

        return $children;
    }
508627
public function getCategory4Id($categoryId)
    {
        /** @var \ZfcTicketSystem\Entity\Repository\TicketCategory $repository */
        $repository = $this->getEntityManager()->getRepository($this->getEntityOptions()->getTicketCategory());
        return $repository->getCategory4Id($categoryId);
    }
421576
private function getStore($storeId)
    {
        if (! isset($this->store)) {
            $this->store = $this->storeManager->getStore($storeId);
        }

        return $this->store;
    }
609981
public function getRoot($categoryId)
    {
        $category = CategoryQuery::create()->findPk($categoryId);

        if (0 !== $category->getParent()) {
            $parentCategory = CategoryQuery::create()->findPk($category->getParent());

            if (null !== $parentCategory) {
                $categoryId = $this->getRoot($parentCategory->getId());
            }
        }

        return $categoryId;
    }
988140
public function getProductBlacklist($categoryId, $storeId)
    {
        $select = $this->getBaseSelect()
            ->columns(['product_id'])
            ->where('category_id = ?', (int) $categoryId)
            ->where('store_id = ?', (int) $storeId)
            ->where('is_blacklisted = ?', (int) true);

        return $this->getConnection()->fetchCol($select);
    }
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);
    }