Get the inactive categories

@param array $customCategories

@return Collection|null
558081
protected function getInactiveCategories(array $customCategories = [])
    {
        // Find only the categories that still can display some results combined with active categories
        if ($this->activeCategories !== null) {
            $columns = [];
            $values = [];

            // Collect the news that match all active categories
            /** @var NewsCategoryModel $activeCategory */
            foreach ($this->activeCategories as $activeCategory) {
                $criteria = new NewsCriteria(System::getContainer()->get('contao.framework'));

                try {
                    $criteria->setBasicCriteria($this->news_archives);
                    $criteria->setCategory($activeCategory->id, false, (bool) $this->news_includeSubcategories);
                } catch (NoNewsException $e) {
                    continue;
                }

                $columns = array_merge($columns, $criteria->getColumns());
                $values = array_merge($values, $criteria->getValues());
            }

            // Should not happen but you never know
            if (count($columns) === 0) {
                return null;
            }

            $newsIds = Database::getInstance()
                ->prepare('SELECT id FROM tl_news WHERE ' . implode(' AND ', $columns))
                ->execute($values)
                ->fetchEach('id')
            ;

            if (count($newsIds) === 0) {
                return null;
            }

            $categoryIds = Model::getRelatedValues('tl_news', 'categories', $newsIds);
            $categoryIds = \array_map('intval', $categoryIds);
            $categoryIds = \array_unique(\array_filter($categoryIds));

            // Include the parent categories
            if ($this->news_includeSubcategories) {
                foreach ($categoryIds as $categoryId) {
                    $categoryIds = array_merge($categoryIds, Database::getInstance()->getParentRecords($categoryId, 'tl_news_category'));
                }
            }

            // Remove the active categories, so they are not considered again
            $categoryIds = array_diff($categoryIds, $this->activeCategories->fetchEach('id'));

            // Filter by custom categories
            if (count($customCategories) > 0) {
                $categoryIds = array_intersect($categoryIds, $customCategories);
            }

            if (count($categoryIds) === 0) {
                return null;
            }

            $customCategories = $categoryIds;
        }

        return NewsCategoryModel::findPublishedByArchives($this->news_archives, $customCategories);
    }
209684
protected function getCategories()
    {
        $limit        = isset($this->params['limit'])
            ? (int)$this->params['limit']
            : null;
        $offset       = isset($this->params['offset'])
            ? (int)$this->params['offset']
            : null;
        $uids         = isset($this->params['uids'])
            ? (array)$this->params['uids']
            : array();
        $responseType = isset($this->params['response_type'])
            ? $this->params['response_type']
            : false;

        $supportedResponseTypes = $this->config->getSupportedResponseTypes();
        if (!empty($responseType) && !in_array($responseType, $supportedResponseTypes['get_categories'])) {
            throw new ShopgateLibraryException(
                ShopgateLibraryException::PLUGIN_API_UNSUPPORTED_RESPONSE_TYPE,
                'Requested type: "' . $responseType . '"'
            );
        }

        $this->plugin->startGetCategories($limit, $offset, $uids, $responseType);

        switch ($responseType) {
            default:
            case 'xml':
                $response     = new ShopgatePluginApiResponseAppXmlExport($this->trace_id);
                $responseData = $this->config->getCategoriesXmlPath();
                break;

            case 'json':
                $response     = new ShopgatePluginApiResponseAppJsonExport($this->trace_id);
                $responseData = $this->config->getCategoriesJsonPath();
                break;
        }

        if (empty($this->response)) {
            $this->response = $response;
        }

        $this->responseData = $responseData;
    }
1274535
public function getActCategory()
    {
        $oCat = oxNew(\OxidEsales\Eshop\Application\Model\Category::class);

        return ($oCat->load($this->getActCatId())) ? $oCat : null;
    }
221649
public function getCategory($key)
    {
        return array_key_exists($key, $this->_categories) ? $this->_categories[$key] : null;
    }
1127812
private function getCategory()
    {
        $storeId    = $this->getStoreId();
        $categoryId = $this->getCategoryId();
        $category   = null;

        if ($this->getCategoryId()) {
            $category = $this->categoryRepository->get($categoryId, $storeId);
        }

        return $category;
    }
920423
private function _getCategory($tables)
    {
        if (isset($tables['category']) && $tables['category'] == 'database-table-name') {
            $category = $this->_normalizeTablename($tables['table']);
        } else {
            $category = Scanner::CATEGORY_DATABASE;
        }

        return $category;
    }
950835
private function findCategoriesWithoutParents()
    {
        // get categories that have no parent but depth > 0
        $qb = $this->categoryRepository->createQueryBuilder('c2')
            ->select('count(c2.id)')
            ->leftJoin('c2.parent', 'c1')
            ->where('c2.depth <> 0 AND c2.parent IS NULL');

        return $qb->getQuery()->getSingleScalarResult();
    }
1136141
protected function getCategories()
    {
        $customCategories = $this->news_customCategories ? StringUtil::deserialize($this->news_categories, true) : [];

        // Get the subcategories of custom categories
        if (\count($customCategories) > 0) {
            $customCategories = NewsCategoryModel::getAllSubcategoriesIds($customCategories);
        }

        // Get all categories whether they have news or not
        if ($this->news_showEmptyCategories) {
            if (\count($customCategories) > 0) {
                $categories = NewsCategoryModel::findPublishedByIds($customCategories);
            } else {
                $categories = NewsCategoryModel::findPublished();
            }
        } else {
            // Get the categories that do have news assigned
            $categories = NewsCategoryModel::findPublishedByArchives($this->news_archives, $customCategories);
        }

        return $categories;
    }
1359886
public function getPostsByCategory($category)
    {
        if (false === array_key_exists($category, $this->categoryIndex)) {
            return [];
        }

        $postNames = $this->categoryIndex[$category];

        return $this->getPostsByName($postNames);
    }
368617
public function setAllowedCategories($categories)
    {
        if (is_string($categories)) {
            $categories = preg_split('/\s*,\s*/', $categories);
        }
        $this->allowedCategories = (array)$categories;
        return $this;
    }
556652
public function getChildrenCategories(
        CategoryInterface $parentCategory,
        $recursively = false
    ) {
        $categories = $this
            ->createQueryBuilder('c')
            ->where('c.parent = :parent_category')
            ->setParameters([
                'parent_category' => $parentCategory,
            ])
            ->getQuery()
            ->getResult();

        if ($recursively && !empty($categories)) {
            foreach ($categories as $category) {
                $categories = array_merge(
                    $categories,
                    $this->getChildrenCategories($category, true)
                );
            }
        }

        return $categories;
    }
59277
public function getCategories() {
    $cid = __METHOD__;
    if ($cache = $this->cache->get($cid)) {
      return $cache->data;
    }

    $link = $this->getUrlFromOpenyProgramsSearchSettings('get_categories_path');
    $result = $this->scrapeCategoryList($link);
    $data = array_combine(array_values($result), array_values($result));

    $this->cache->set($cid, $data);
    return $data;
  }
1123933
public function getRootCategoryWithChildren(CategoryInterface $category)
    {
        if (null === $category->getContext()) {
            throw new \RuntimeException('Context cannot be null');
        }
        if (null !== $category->getParent()) {
            throw new \RuntimeException('Method can be called only for root categories');
        }
        $context = $this->getContext($category->getContext());

        $this->loadCategories($context);

        foreach ($this->categories[$context->getId()] as $contextRootCategory) {
            if ($category->getId() === $contextRootCategory->getId()) {
                return $contextRootCategory;
            }
        }

        throw new \RuntimeException('Category does not exist');
    }
416995
public function getFilters()
    {
        // default filters are empty
        $filters = [];

        // if custom filters have been set, use them
        if (!is_null($this->filters)) {
            return $this->filters;
        }

        // if no custom filters have been set, and there are
        // Taxonomies assigned to the PostType
        if (is_null($this->filters) && !empty($this->taxonomies)) {
            // create filters for each taxonomy assigned to the PostType
            return $this->taxonomies;
        }

        return $filters;
    }
86447
public static function getCategories()
    {
        $app = App::getInstance();

        $manager = BaseManager::build('FelixOnline\Core\Category', 'category');

        try {
            $values = $manager->filter('hidden = 0')
                            ->filter('deleted = 0')
                            ->filter('id > 0')
                            ->order('order', 'ASC')
                            ->values();

            return $values;
        } catch (\Exception $e) {
            return array();
        }
    }
407166
public function all(array $categories = array())
	{
		$handlers = array();

		foreach ($this->handlers as $handler)
		{
			$handlerCategories = $this->handlers->getInfo();
			if (array() === $categories || array() !== array_intersect($handlerCategories, $categories))
			{
				$handlers[] = $handler;
			}
		}

		return $handlers;
	}
36300
private function removeDefaultCategories($categoryIds)
    {
        $returnArray = [];
        $basicCategoryIds = [
            1,
            $this->storeManager->getStore()->getRootCategoryId(),
        ];
        foreach ($categoryIds as $categoryId) {
            if (!in_array($categoryId, $basicCategoryIds)) {
                $returnArray[] = $categoryId;
            }
        }

        return $returnArray;
    }