@param Category $category

@return array
769743
public function serialize(Category $category)
    {
        return [
            'id' => $category->getId(),
            'name' => $category->getName(),
            'order' => $category->getOrder(),
            'user' => $this->userSerializer->serialize($category->getUser()),
        ];
    }
748622
public function get_course_ids($categories) {
        $courseids = array();
        foreach ($categories as $key=>$cat) {
            $courseids[$key] = $cat->course;
            if (!empty($cat->children)) {
                $courseids = array_merge($courseids, $this->get_course_ids($cat->children));
            }
        }
        return $courseids;
    }
826936
public function getAll($category, $context)
    {
        $model = $this->getModel($category);

        return $model->getAll($context);
    }
37588
public static function targetConfigs(array $categories): array
    {
        $configs = [];

        foreach ($categories as $category) {
            $configs[$category] = static::targetConfig($category);
        }

        return array_filter($configs);
    }
740029
public function getMessages($category, $language)
    {
        $key = $language . '/' . $category;
        if (!isset($this->_messages[$key])) {
            $this->_messages[$key] = $this->loadMessages($category, $language);
        }

        return $this->_messages[$key];
    }
1111963
public function getBranchByCategory(Category $category, $lang = null)
    {
        $this->initNodeVersions();

        $lang = $lang ?: $this->currentLocale->getCurrentLocale();

        $matches = function (Branch $branch) use ($category, $lang) {
            return $category->getNodeId() === $branch->getNodeId() && $lang === $branch->getLang();
        };

        return array_reduce($this->branches, function (Branch $result = null, Branch $branch) use ($matches) {
            return  $matches($branch) ? $branch : $result;
        });
    }
1036283
protected function _loadArticles($category)
    {
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();

        $numberOfCategoryArticles = (int) $config->getConfigParam('iNrofCatArticles');
        $numberOfCategoryArticles = $numberOfCategoryArticles ? $numberOfCategoryArticles : 1;

        // load only articles which we show on screen
        $articleList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class);
        $articleList->setSqlLimit($numberOfCategoryArticles * $this->_getRequestPageNr(), $numberOfCategoryArticles);
        $articleList->setCustomSorting($this->getSortingSql($this->getSortIdent()));

        if ($category->isPriceCategory()) {
            $priceFrom = $category->oxcategories__oxpricefrom->value;
            $priceTo = $category->oxcategories__oxpriceto->value;

            $this->_iAllArtCnt = $articleList->loadPriceArticles($priceFrom, $priceTo, $category);
        } else {
            $sessionFilter = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('session_attrfilter');

            $activeCategoryId = $category->getId();
            $this->_iAllArtCnt = $articleList->loadCategoryArticles($activeCategoryId, $sessionFilter);
        }

        $this->_iCntPages = ceil($this->_iAllArtCnt / $numberOfCategoryArticles);

        return $articleList;
    }
883143
public function addCategory($category)
    {
        if (!($category instanceof Category)) {
            $category = new Category($category);
        }
        $this->categories[] = $category;
    }
591605
private function getCategory($categoryId)
    {
        if (!array_key_exists($categoryId, $this->categories)) {
            $categoryCollection = $this->categoryCollectionFactory->create();
            foreach ($categoryCollection as $category) {
                $this->categories[$category->getId()] = $category;
            }
        }

        return $this->categories[$categoryId];
    }
44398
public function getCategoryUrls(string $category, array $criteria = [], $siteId = null): array
    {
        return RouteMap::$plugin->routes->getCategoryUrls($category, $criteria, $siteId);
    }
1017758
public function category($category)
    {
        $categoryId = NotificationCategory::getIdByCategory($category);
        $this->setNotificationData('category_id', $categoryId);

        return $this;
    }
1241549
public function add($category)
    {
        if (is_array($category)) {
            $this->collection[] = new Category($category);
        } elseif (is_object($category) && $category instanceof Category) {
            $this->collection[] = $category;
        }

        return $this;
    }
728324
public function descendantsOf(ChildCategory $category)
    {
        return $this
            ->addUsingAlias(ChildCategory::LEFT_COL, $category->getLeftValue(), Criteria::GREATER_THAN)
            ->addUsingAlias(ChildCategory::LEFT_COL, $category->getRightValue(), Criteria::LESS_THAN);
    }
289020
public static function getAllSubcategoriesIds($category)
    {
        $ids = Database::getInstance()->getChildRecords($category, static::$strTable, false, (array) $category, (!BE_USER_LOGGED_IN ? 'published=1' : ''));
        $ids = \array_map('intval', $ids);

        return $ids;
    }
802272
public function query(Category $category = null): array
    {
        if (! $category->exists) {
            $category->setRelation('term', [new Term()]);
        }

        return [
            'category' => $category,
            'catselect'=> $category->getAllCategories(),
        ];
    }
1052642
private static function _get_children_recursion($category) {

        $children_array = array();
        foreach ($category->children as $sortorder=>$child) {

            if (array_key_exists('itemtype', $child)) {
                $grade_item = new grade_item($child, false);

                if (in_array($grade_item->itemtype, array('course', 'category'))) {
                    $type  = $grade_item->itemtype.'item';
                    $depth = $category->depth;

                } else {
                    $type  = 'item';
                    $depth = $category->depth; // we use this to set the same colour
                }
                $children_array[$sortorder] = array('object'=>$grade_item, 'type'=>$type, 'depth'=>$depth);

            } else {
                $children = grade_category::_get_children_recursion($child);
                $grade_category = new grade_category($child, false);

                if (empty($children)) {
                    $children = array();
                }
                $children_array[$sortorder] = array('object'=>$grade_category, 'type'=>'category', 'depth'=>$grade_category->depth, 'children'=>$children);
            }
        }

        // sort the array
        ksort($children_array);

        return $children_array;
    }
1229187
public function getCategoryConfig($category)
    {
        if (!array_key_exists($category, $this->config)) {
            $query = $this->entityManager->createQueryBuilder()
                ->select('config')
                ->from(
                    '\Reliv\RcmConfig\Entity\RcmConfig',
                    'config',
                    'config.id'
                )
                ->where('config.category = :category')
                ->getQuery();
            $query->setParameter('category', $category);

            $results = $query->getResult();
            $preparedResult = [];

            /**
             * @var                                   $context
             * @var \Reliv\RcmConfig\Entity\RcmConfig $item
             */
            foreach ($results as $id => $item) {
                $context = $item->getContext();
                if (!array_key_exists($context, $preparedResult)) {
                    $preparedResult[$context] = [];
                }
                $preparedResult[$context][$item->getName()] = $item->getValue();
            }

            $this->config[$category] = $preparedResult;
        }

        return $this->config[$category];
    }