@see http://4221117.shop53.dandomain.dk/admin/webapi/endpoints/v1_0/ProductService/help/operations/GetCategory

@param int $categoryId
@param int $siteId
@return array
504663
public function getCategory(int $categoryId, int $siteId) : array
    {
        Assert::that($categoryId)->greaterThan(0, 'The $categoryId has to be positive');
        Assert::that($siteId)->greaterThan(0, 'The $siteId has to be positive');

        return (array)$this->master->doRequest(
            'GET',
            sprintf('/admin/WEBAPI/Endpoints/v1_0/ProductService/{KEY}/Category/%d/%d', $categoryId, $siteId)
        );
    }
1251386
public function getCategoryRouteRules(string $category, string $format = 'Craft', $siteId = null): array
    {
        return RouteMap::$plugin->routes->getCategoryRouteRules($category, $format, $siteId);
    }
814062
public static function getActions($extension, $categoryId = 0)
	{
		// Log usage of deprecated function
		JLog::add(__METHOD__ . '() is deprecated, use JHelperContent::getActions() with new arguments order instead.', JLog::WARNING, 'deprecated');

		// Get list of actions
		return JHelperContent::getActions($extension, 'category', $categoryId);
	}
405788
public function actionGetCategoryRouteRules(string $category, string $format = 'Craft', $siteId = null): Response
    {
        return $this->asJson(RouteMap::$plugin->routes->getCategoryRouteRules($category, $format, $siteId));
    }
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;
    }
738701
protected function getSolrRootlineForCategoryId($categoryId)
    {
        $categoryIdRootline = $this->buildCategoryIdRootline($categoryId);
        $solrRootline = $this->buildSolrHierarchyFromIdRootline($categoryIdRootline);

        return $solrRootline;
    }
482071
public function getChildrenCount($categoryId)
    {
        $select = $this->getConnection()->select()->from(
            $this->getEntityTable(),
            'children_count'
        )->where(
            'entity_id = :entity_id'
        );
        $bind = ['entity_id' => $categoryId];

        return $this->getConnection()->fetchOne($select, $bind);
    }
496705
protected function SelectByCategory($CategoryID) {
      $CategoryID = GetValue('CategoryID', $Parameters, NULL);
      if (!$CategoryID) return FALSE;
      
      // Check cache
      $SelectorCategoryCacheKey = "modules.promotedcontent.category.{$CategoryID}";
      $Content = Gdn::Cache()->Get($SelectorCategoryCacheKey);
      
      if ($Content == Gdn_Cache::CACHEOP_FAILURE) {
      
         // Get matching Discussions
         $Discussions = Gdn::SQL()->Select('d.*')
            ->From('Discussion d')
            ->Where('d.CategoryID', $CategoryID)
            ->OrderBy('DateInserted', 'DESC')
            ->Limit($this->Limit)
            ->Get()->Result(DATASET_TYPE_ARRAY);

         // Get matching Comments
         $CommentDiscussionIDs = Gdn::SQL()->Select('d.DiscussionID')
            ->From('Discussion d')
            ->Where('d.CategoryID', $CategoryID)
            ->OrderBy('DateLastComment', 'DESC')
            ->Limit($this->Limit)
            ->Get()->Result(DATASET_TYPE_ARRAY);
         
         $Comments = Gdn::SQL()->Select('c.*')
            ->From('Comment c')
            ->WhereIn('DiscussionID', $CommentDiscussionIDs)
            ->OrderBy('DateInserted', 'DESC')
            ->Limit($this->Limit)
            ->Get()->Result(DATASET_TYPE_ARRAY);
         
         $this->JoinCategory($Comments);
         
         // Interleave
         $Content = $this->Union('DateInserted', array(
            'Discussion'   => $Discussions, 
            'Comment'      => $Comments
         ));
         $this->Prepare($Content);
         
         // Add result to cache
         Gdn::Cache()->Store($SelectorCategoryCacheKey, $Content, array(
            Gdn_Cache::FEATURE_EXPIRY  => $this->Expiry
         ));
      }
      
      $this->Security($Content);
      $this->Condense($Content, $this->Limit);
      return $Content;
   }
1303983
public function cgetAction($categoryId, Request $request)
    {
        /** @var RestHelperInterface $restHelper */
        $restHelper = $this->get('sulu_core.doctrine_rest_helper');

        /** @var DoctrineListBuilderFactory $factory */
        $factory = $this->get('sulu_core.doctrine_list_builder_factory');

        /** @var CategoryInterface $category */
        $category = $this->getCategoryRepository()->find($categoryId);

        $fieldDescriptor = $this->getFieldDescriptors();

        $listBuilder = $factory->create($this->getParameter('sulu.model.keyword.class'));
        $restHelper->initializeListBuilder($listBuilder, $fieldDescriptor);

        $listBuilder->where($fieldDescriptor['locale'], $request->get('locale'));
        $listBuilder->where(
            $fieldDescriptor['categoryTranslationIds'],
            $category->findTranslationByLocale($request->get('locale'))
        );

        // should eliminate duplicates
        $listBuilder->distinct(true);
        $listBuilder->addGroupBy($fieldDescriptor['id']);

        $listResponse = $listBuilder->execute();

        $list = new ListRepresentation(
            $listResponse,
            self::$entityKey,
            'get_category_keywords',
            array_merge(['categoryId' => $categoryId], $request->query->all()),
            $listBuilder->getCurrentPage(),
            $listBuilder->getLimit(),
            $listBuilder->count()
        );

        return $this->handleView($this->view($list, 200));
    }
77624
private function handleCategory($categoryId)
    {
        $categoryData = $this->getCategory($categoryId);

        if ($categoryData instanceof CategoryModel) {
            return $categoryData->getPath();
        }

        return '';
    }
575251
private static function findAllAncestry($categoryId, $parentCategoriesArray = [])
    {
        $category = Category::findOne($categoryId);
        if (!empty($category)) {
            $parentCategoryId = $category->parent_id;
        }
        else throw new NotFoundHttpException();

        if (!empty($parentCategoryId)) {
            $parentCategoriesArray[] = $parentCategoryId;
            return self::findAllAncestry($parentCategoryId, $parentCategoriesArray);
        } else return $parentCategoriesArray;
    }
736082
public function saveFilter($categoryId, $filterId, $type)
    {
        $filterModel = CategoryFilter::whereCategoryId($categoryId)
                                        ->whereFilterId($filterId)
                                        ->whereType('PROPERTY')->first();
        if (null === $filterModel) {
            CategoryFilter::create([
                'category_id' => $categoryId,
                'filter_id' => $filterId,
                'type' => 'PROPERTY'
            ]);
        }
    }
847187
private function getStandardCategoriesQuery(array $categoryIds, $excludedCategories)
    {
        $conditionsParams  = ['data' => ['attribute' => 'category_ids', 'operator' => '()', 'value' => $categoryIds]];
        $categoryCondition = $this->productConditionsFactory->create($conditionsParams);

        return $this->queryBuilder->getSearchQuery($categoryCondition, $excludedCategories);
    }
1031627
private function getSlugParts(int $categoryId, string $locale): array
    {
        $category = $this->repo->getCategoriesPlain()->where('id', $categoryId)->first();
        $slugParts = [];

        if (!$category) {
            // Try to fetch from DB
            $category = Category::find($categoryId);

            if (!$category) {
                return [];
            }

            $category = [
                'id'        => $category->id,
                'parent_id' => $category->parent_id,
                'slugs'     => $category->translations->pluck('slug', 'locale')->toArray(),
            ];
        }

        $slugParts[] = array_get($category, 'slugs.' . $locale);

        if (isset($category['parent_id']) && $category['parent_id']) {
            $slugParts = array_merge($slugParts, $this->getSlugParts($category['parent_id'], $locale));
        }

        return $slugParts;
    }
195184
private function SaveCategoryPage($categoryID)
    {
        $category = Category::Schema()->ByID($categoryID);
        if ($category) {
            $category->SetPage($this->Page());
            $category->Save();
        }
    }
1143393
public function indexAction($categoryId)
    {
        $em = $this->getDoctrine()->getManager();

        /** @var Category $entity */
        $entity = $em->getRepository('EcommerceBundle:Category')->find($categoryId);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Category entity.');
        }

        return array(
            'category' => $entity,
        );
    }
683163
public static function get_category_courses_visibility($categoryid) {
        global $DB;
        $sql = "SELECT c.id, c.visible
                  FROM {course} c
                 WHERE c.category = :category";
        $params = array('category' => (int)$categoryid);
        return $DB->get_records_sql($sql, $params);
    }