Load blacklisted products for the given query.

@param CategoryInterface|int $category Category.

@return array
555604
public function getProductBlacklistByCategory($category)
    {
        $storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID;
        if (is_object($category)) {
            if ($category->getUseStorePositions()) {
                $storeId = $category->getStoreId();
            }
            $category = $category->getId();
        }

        return $this->getProductBlacklist($category, $storeId);
    }
119335
public function loadCategory($categoryId, \DmsLoaderParams $params)
  {
    $objCategory = $this->Database->prepare("SELECT * FROM tl_dms_categories WHERE id = ?")
                    ->limit(1)
                    ->execute($categoryId);
    
    $category = null;
    if ($objCategory->numRows)
    {
      $category = $this->buildCategory($objCategory);
      if ($params->loadAccessRights)
      {
        $category->accessRights = $this->getAccessRights($category, $params);
      }
      if ($params->loadDocuments)
      {
        $category->documents = $this->getDocuments($category, $params);
      }
      if ($params->loadRootCategory)
      {
        $category->parentCategory = $this->loadCategory($category->parentCategoryId, $params);
      }
    }

    return $category;
  }
915896
public function destroy(Category $category)
    {
        $this->category->destroy($category);

        return redirect()->route('admin.product.category.index')
            ->withSuccess(trans('core::core.messages.resource deleted', ['name' => trans('product::categories.title.categories')]));
    }
945092
protected function getModuleByTransCategory($category)
    {
        foreach(TranslationsBuilder::$transCatToModule as $pattern => $module) {
            if (0 === strpos($category, rtrim($pattern, '*'))) {
                return $module;
            }
        }
    }
556406
public function addCategory($category)
    {
        if ( ! in_array($category, (array)$this->categories)) {
            $this->categories[] = $category;
        }

        return $this;
    }
417082
private function getCategoryFilterParam(\Magento\Catalog\Model\Category $category)
    {
        $filterParam = $category->getId();

        if ($category->getVirtualRule()) { // Implicit dependency to Virtual Categories module.
            $category->setIsActive(true);

            $filterParam = $category->getVirtualRule()->getCategorySearchQuery($category);
        }

        return $filterParam;
    }
1321940
public function category(Category $category)
    {
        $this->_category = $category;

        $this->joinWith('categories');
        $this->andFilterWhere([$category::tableName().'.id' => $this->_category->id]);

        return $this;
    }
1112591
private function formatCategories(array $categories) {

    $terms = [];

    foreach ($categories as $cid) {
      $term = $this->categoryRepo->loadCategoryTerm($cid);
      if ($term) {
        $terms[] = $term->id();
      }
    }

    return ($terms);
  }
844533
private function getStoreId(Category $category)
    {
        $storeId = $category->getStoreId();

        if ($storeId === 0) {
            $defaultStoreId   = $this->getDefaultStoreId();
            $categoryStoreIds = array_filter($category->getStoreIds());
            $storeId        = current($categoryStoreIds);
            if (in_array($defaultStoreId, $categoryStoreIds)) {
                $storeId = $defaultStoreId;
            }
        }

        return $storeId;
    }
1006278
public function loadAttributesData(int $categoryId)
    {
        $binds = [':category_id' => $categoryId];

        $select = $this->getConnection()->select();
        $select->from($this->getMainTable())->where(sprintf("%s = :category_id", $this->getIdFieldName()));

        return $this->getConnection()->fetchAll($select, $binds);
    }
1058011
public function getChildren ($category)
		{
			$children = [];
			foreach ($this->_data as $item)
				if ($item->lft > $category->lft and $item->rgt < $category->rgt)
					$children[] = $item;

			return $children;
		}
687910
protected function find_categories_after($category) {
        $return = array();
        $categoryarray = $this->categories;
        foreach ($categoryarray as $categoryelement) {
            if ($categoryelement->after == $category->name) {
                // Find all categories that comes after this category as well.
                $categoryelement->sort_nodes();
                $return = array_merge($return, array($categoryelement->name => $categoryelement),
                        $this->find_categories_after($categoryelement));
            }
        }
        return $return;
    }
157150
public function prune($category = null)
    {
        if ($category) {
            $this->addUsingAlias(CategoryTableMap::COL_ID, $category->getId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }
330283
private function getVirtualRootCategory(CategoryInterface $category)
    {
        $storeId      = $this->getStoreId();
        $rootCategory = $this->categoryFactory->create()->setStoreId($storeId);

        if ($category->getVirtualCategoryRoot() !== null && !empty($category->getVirtualCategoryRoot())) {
            $rootCategoryId = $category->getVirtualCategoryRoot();
            $rootCategory->load($rootCategoryId);
        }

        if ($rootCategory && $rootCategory->getId()
            && ($rootCategory->getLevel() < 1 || (int) $rootCategory->getId() === (int) $this->getRootCategoryId($storeId))
        ) {
            $rootCategory = null;
        }

        return $rootCategory;
    }
612835
public function getTrailIds(NewsCategoryModel $category)
    {
        static $ids;

        if (!\is_array($ids)) {
            /** @var Database $db */
            $db = $this->framework->createInstance(Database::class);

            $ids = $db->getParentRecords($category->id, $category->getTable());
            $ids = \array_map('intval', \array_unique($ids));

            // Remove the current category
            unset($ids[\array_search($category->id, $ids, true)]);
        }

        return $ids;
    }
779743
public function getBrands($category, $limit = null)
    {
        $qb = $this->getQueryBuilder()
            ->select('DISTINCT b.id, b.name')
            ->innerJoin('c.products', 'p')
            ->innerJoin('p.brand', 'b')
            ->where('p.active = TRUE')
            ->andWhere('b.available = TRUE');

        if ($category->getFamily()) {
            // this is a category
            $qb->andWhere('c.parentCategory = :category')
                ->setParameter('category', $category);
        } else {
            // this is a subcategory
            $qb->andWhere('c = :category')
                ->setParameter('category', $category);
        }

        if (!is_null($limit)) {
            $qb->setMaxResults($limit);
        }

        return $qb->getQuery()
            ->getResult();
    }
719848
static function fetchCountByCategory( $categories )
    {
        $db = eZDB::instance();

        $query = "SELECT COUNT(*) AS count FROM ezvatrule vr, ezvatrule_product_category vrpc " .
                 "WHERE vr.id=vrpc.vatrule_id AND ";

        if ( is_array( $categories ) )
        {
            $query .= $db->generateSQLINStatement( $categories, 'vrpc.product_category_id', false, false, 'int' );
        }
        else
        {
            $query .= "vrpc.product_category_id =" . (int) $categories;
        }

        $rows = $db->arrayQuery( $query );

        return $rows[0]['count'];
    }