Searches forums.
@param int|null $categoryId
@return ActiveDataProvider
967475
public function search($categoryId = null, $onlyVisible = false)
    {
        $query = static::find();
        if ($categoryId) {
            $query->andWhere(['category_id' => $categoryId]);
        }
        if ($onlyVisible) {
            $query->joinWith(['category' => function ($query) {
                $query->andWhere([Category::tableName() . '.visible' => 1]);
            }]);
            $query->andWhere([static::tableName() . '.visible' => 1]);
        }

        $dataProvider = new ActiveDataProvider(['query' => $query]);
        $dataProvider->sort->defaultOrder = ['sort' => SORT_ASC, 'id' => SORT_ASC];
        return $dataProvider;
    }
731989
public function findTranslated($category, $languageId)
    {
        return CategoryTranslation::whereCategoryId($category->id)
            ->whereLanguageId($languageId)
            ->first();
    }
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;
        }
    }
707858
public function deleteAction($categoryId, $keywordId)
    {
        $keyword = $this->getKeywordRepository()->findById($keywordId);
        $category = $this->getCategoryRepository()->findCategoryById($categoryId);
        $this->getKeywordManager()->delete($keyword, $category);

        $this->getEntityManager()->flush();

        return $this->handleView($this->view());
    }
670407
public function search($params)
    {
        $query = Category::find();
        $query->orderBy('position DESC, title');

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
            'parent_id' => $this->parent_id,
            'position' => $this->position,
        ]);

        $query->andFilterWhere(['like', 'title', $this->title])
            ->andFilterWhere(['like', 'alias', $this->alias]);

        return $dataProvider;
    }
173878
public function addCategoryToAllowedRoots($categoryId)
    {
        if (null === ($roots = $this->getUserAllowedRoots())) {
            return;
        }

        $categoryId = (int) $categoryId;
        $user = $this->getUser();

        /** @var StringUtil $stringUtil */
        $stringUtil = $this->framework->getAdapter(StringUtil::class);

        // Add the permissions on group level
        if ('custom' !== $user->inherit) {
            $groups = $this->db->fetchAll('SELECT id, newscategories, newscategories_roots FROM tl_user_group WHERE id IN('.\implode(',', \array_map('intval', $user->groups)).')');

            foreach ($groups as $group) {
                $permissions = $stringUtil->deserialize($group['newscategories'], true);

                if (\in_array('manage', $permissions, true)) {
                    $categoryIds = $stringUtil->deserialize($group['newscategories_roots'], true);
                    $categoryIds[] = $categoryId;

                    $this->db->update('tl_user_group', ['newscategories_roots' => \serialize($categoryIds)], ['id' => $group['id']]);
                }
            }
        }

        // Add the permissions on user level
        if ('group' !== $user->inherit) {
            $userData = $this->db->fetchAssoc('SELECT newscategories, newscategories_roots FROM tl_user WHERE id=?', [$user->id]);
            $permissions = $stringUtil->deserialize($userData['newscategories'], true);

            if (\in_array('manage', $permissions, true)) {
                $categoryIds = $stringUtil->deserialize($userData['newscategories_roots'], true);
                $categoryIds[] = $categoryId;

                $this->db->update('tl_user', ['newscategories_roots' => \serialize($categoryIds)], ['id' => $user->id]);
            }
        }

        // Add the new element to the user object
        $user->newscategories_roots = \array_merge($roots, [$categoryId]);
    }
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;
    }
132542
public function getSubCategoriesPager($categoryId, $page = 1, $limit = 25, $criteria = [])
    {
        $queryBuilder = $this->getObjectManager()->createQueryBuilder()
            ->select('c')
            ->from($this->class, 'c')
            ->where('c.parent = :categoryId')
            ->setParameter('categoryId', $categoryId);

        $pager = new Pager($limit);
        $pager->setQuery(new ProxyQuery($queryBuilder));
        $pager->setPage($page);
        $pager->init();

        return $pager;
    }
821725
public function getModulesFromDb($actived=null)
	{
		$criteria = new CDbCriteria;
		if($actived == null) {
			$criteria->condition = 'folder <> :folder';
			$criteria->params = array(
				':folder'=>'-',
			);		
		} else if($actived == 'enabled') {
			$criteria->condition = 'actived <> :actived AND folder <> :folder';
			$criteria->params = array(
				':actived'=>0,
				':folder'=>'-',
			);
		} else {
			$criteria->condition = 'actived = :actived AND folder <> :folder';
			$criteria->params = array(
				':actived'=>$actived,
				':folder'=>'-',
			);
		}
		$criteria->compare('parent_id', 0);
		$criteria->order = 'folder ASC';
		$modules = OmmuPlugins::model()->findAll($criteria);
		
		return $modules;
	}
14578
public function search()
    {
        $dataProvider = new ActiveDataProvider([
            'query' => static::find()->where(['user_id' => User::loggedId()]),
            'pagination' => [
                'defaultPageSize' => 10,
                'forcePageParam' => false
            ],
        ]);
        $dataProvider->sort->defaultOrder = ['post_seen' => SORT_ASC, 'id' => SORT_DESC];
        $dataProvider->pagination->pageSize = Yii::$app->session->get('per-page', 20);
        return $dataProvider;
    }
551869
protected function is_category_fully_loaded($categoryid) {
        return (array_key_exists($categoryid, $this->addedcategories) && ($this->allcategoriesloaded || $this->addedcategories[$categoryid]->children->count() > 0));
    }
346836
protected function getCategory($categoryId, $storeViewCode = StoreViewCodes::ADMIN)
    {
        return $this->getSubject()->getCategory($categoryId, $storeViewCode);
    }
624261
public function search($forumId, $threadId)
    {
        $dataProvider = new ActiveDataProvider([
            'query' => static::find()->where(['forum_id' => $forumId, 'thread_id' => $threadId]),
            'pagination' => [
                'defaultPageSize' => 10,
                'pageSizeLimit' => false,
                'forcePageParam' => false
            ],
        ]);
        $dataProvider->sort->defaultOrder = ['id' => SORT_ASC];
        return $dataProvider;
    }
1300513
private function getSearchableCategories($storeId, $categoryIds = null, $fromId = 0, $limit = 100)
    {
        return $this->resourceModel->getSearchableCategories($storeId, $categoryIds, $fromId, $limit);
    }
377732
public function findEntitiesByCategoryId($categoryId, $locale)
    {
        $products = $this->productRepository->findByCategoryId($categoryId, $locale);

        return $products;
    }
824030
public function search($params)
    {
        $query = Model::find();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere([
            'menu_id' => $this->menuId,
        ]);

        $query->andFilterWhere(['like', 'menu', $this->menu]);

        return $dataProvider;
    }
125041
public function get($categoryId, $params = array())
    {
        $resource = 'category/' . $categoryId . '.json';
        $resource .= '?' . $this->buildQueryString($params);
        $response = $this->getServiceResponse($resource);

        $getCategoryResponse = new Models\ResponseCategoryGet($response);

        return $getCategoryResponse->getCategory();
    }