Only type "TYPE_CATEGORY"
@return null|\yii\db\ActiveQuery
540270
public function getCategory()
    {
        $categoryModel = static::getCategoryModel();
        return ($this->type == self::TYPE_CATEGORY) ? $this->hasOne($categoryModel::className(), ['id' => $this->options->category_id]) : null;
    }
471267
public function isTopCategory()
    {
        if ($this->_blTopCategory == null) {
            $this->_blTopCategory = $this->oxcategories__oxparentid->value == 'oxrootid';
        }

        return $this->_blTopCategory;
    }
1211442
protected function addQuickSearchConditions(\yii\db\ActiveQuery $query)
    {
        if (!$query instanceof ActiveQuery) {
            return $query;
        }
        $parts = explode(ActiveSearchInterface::TOKEN_SEPARATOR, $query->quickSearchPhrase);
        $searchPhrase = array_filter(array_map('trim', $parts));
        if (count($searchPhrase) === 2 && (string)intval($searchPhrase[0]) === $searchPhrase[0]
            && (string)intval($searchPhrase[1]) === $searchPhrase[1]
        ) {
            // special case, whole term is just one digit with decimal separator
            $searchPhrase = [trim($query->quickSearchPhrase)];
        } elseif (count($parts) > 1) {
            // add the original value for an exact match
            $searchPhrase[] = trim($query->quickSearchPhrase);
        }
        list ($safeAttributes, $relationAttributes) = $this->getQuickSearchAttributes();
        $conditions = ['or'];
        foreach ($searchPhrase as $word) {
            if (($condition = $this->processSearchToken($word, $safeAttributes)) !== null) {
                $conditions[] = $condition;
            }
        }
        if (($condition = $this->processSearchRelated($query, $searchPhrase, $relationAttributes)) !== null) {
            $conditions[] = $condition;
        }
        if ($conditions !== ['or']) {
            $query->andWhere($conditions);
        }
        return $query;
    }
1127812
private function getCategory()
    {
        $storeId    = $this->getStoreId();
        $categoryId = $this->getCategoryId();
        $category   = null;

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

        return $category;
    }
752712
public function getActiveCategory()
    {
        if ($this->_oActCategory === null) {
            $this->_oActCategory = false;
            $category = oxNew(\OxidEsales\Eshop\Application\Model\Category::class);
            if ($category->load($this->getCategoryId())) {
                $this->_oActCategory = $category;
            }
        }

        return $this->_oActCategory;
    }
332017
public static function findActive()
    {
        if (self::$_langInstanceFindActive === null) {
            $langShortCode = Yii::$app->composition->getKey('langShortCode');
    
            if (!$langShortCode) {
                self::$_langInstanceFindActive = self::getDefault();
            } else {
                self::$_langInstanceFindActive = self::find()->where(['short_code' => $langShortCode, 'is_deleted' => false])->asArray()->one();
            }
        }
        
        return self::$_langInstanceFindActive;
    }
221671
public function actionIndex($query)
    {
        $search = [];
        $module = Yii::$app->getModule('admin');

        foreach (Yii::$app->adminmenu->getModules() as $node) {
            if (isset($node['searchModelClass']) && !empty($node['searchModelClass'])) {
                $model = Yii::createObject($node['searchModelClass']);
                if (!$model instanceof GenericSearchInterface) {
                    throw new Exception('The model must be an instance of GenericSearchInterface');
                }
                $data = $this->transformGenericSearchToData($model->genericSearch($query));
                if (count($data) > 0) {
                    $stateProvider = $model->genericSearchStateProvider();
                    $search[] = [
                        'hideFields' => $model->genericSearchHiddenFields(),
                        'type' => 'custom',
                        'menuItem' => $node,
                        'data' => $data,
                        'stateProvider' => $stateProvider,
                    ];
                }
                
                unset($data);
            }
        }

        foreach (Yii::$app->adminmenu->getItems() as $api) {
            if ($api['permissionIsApi']) {
                $ctrl = $module->createController($api['permissionApiEndpoint']);
                $controller = $ctrl[0];
                $data = $this->transformGenericSearchToData($controller->model->genericSearch($query));
                if (count($data) > 0) {
                    $search[] = [
                        'hideFields' => $controller->model->genericSearchHiddenFields(),
                        'type' => 'api',
                        'menuItem' => $api,
                        'data' => $data,
                        'stateProvider' => $controller->model->genericSearchStateProvider(),
                    ];
                }
                
                unset($data);
            }
        }

        $searchData = new SearchData();
        $searchData->query = $query;
        $searchData->num_rows = count($search);
        $searchData->save();

        return $search;
    }
380910
protected function getType(): string
    {
        return join('|', array_filter([
            $this->traversable,
            isset($this->subtype) ? $this->subtype . '[]' : null
        ])) ?: 'array';
    }
605321
public function anyCategoryValues($values, $attribute = null)
    {
        /** @var \yii\db\ActiveRecord $model */
        $model = new $this->owner->modelClass();
        $categoryClass = $model->getRelation($model->categoryRelation)->modelClass;

        $this->owner
            ->innerJoinWith($model->categoryRelation, false)
            ->andWhere([$categoryClass::tableName() . '.' . ($attribute ?: $model->categoryValueAttribute) => $model->filterCategoryValues($values)])
            ->addGroupBy(array_map(function ($pk) use ($model) {
                return $model->tableName() . '.' . $pk;
            }, $model->primaryKey()));

        return $this->owner;
    }
113762
public function search()
    {
        $query = Rubric::find()
            ->where('id>1')
            ->orderBy('lft ASC, position DESC');

        return new ActiveDataProvider([
            'query' => $query,
            'pagination' => [
                'pageSize' => Yii::$app->params['itemsPerPage'],
            ],
        ]);
    }
1268698
public static function GetActiveRootCategory()
    {
        static $oActiveRootCategory = 'x';
        if ('x' === $oActiveRootCategory) {
            $oActiveRootCategory = null;
            $oActiveCategory = self::getShopService()->GetActiveCategory();
            if (null !== $oActiveCategory) {
                $oActiveRootCategory = $oActiveCategory->GetRootCategory();
            }
        }

        return $oActiveRootCategory;
    }
1084169
public function searchType()
    {
        return isset($this->_data['type']) && ResourceTable::validColumnType($this->_data['type']) ? $this->_data['type'] : ResourceTable::DEFAULT_COLUMN_TYPE;
    }
509905
public function applyCategory()
    {
        $this->joinCategoryData();
        $this->removeAdditionalTableDuplicateFields();
        $this->getSelect()->columns($this->getAdditionalColumns());

        $subSelect = new \Zend_Db_Expr(sprintf("(%s)", (string) $this->getSelect()));

        $this->_select = $this->getConnection()->select()->from($subSelect);

        return $this;
    }
1318910
public static function findActiveByType( $type, $config = [] ) {

		$ignoreSite	= isset( $config[ 'ignoreSite' ] ) ? $config[ 'ignoreSite' ] : false;

		if( static::isMultiSite() && !$ignoreSite ) {

			$siteId	= isset( $config[ 'siteId' ] ) ? $config[ 'siteId' ] : Yii::$app->core->siteId;

			return self::queryByType( $type )->andWhere( 'active=:active AND siteId=:siteId', [ ':active' => true, ':siteId' => $siteId ] )->all();
		}
		else {

			return self::queryByType( $type )->andWhere( 'active=:active', [ ':active' => true ] )->all();
		}
	}
456149
protected function getTypeCategory($type)
    {
        $extensions = $this->extensions;
        $navClasses = 'app';
        if (isset($type)) {
            if ($type->name == 'Yii' || $type->name == 'YiiRequirementChecker') {
                $navClasses = 'yii';
            } elseif (strncmp($type->name, 'yii\\', 4) == 0) {
                $navClasses = 'yii';
                $subName = substr($type->name, 4);
                if (($pos = strpos($subName, '\\')) !== false) {
                    $subNamespace = substr($subName, 0, $pos);
                    if (in_array($subNamespace, $extensions)) {
                        $navClasses = $subNamespace;
                    }
                }
            }
        }

        return $navClasses;
    }
1106292
private function checkAlwaysFalseCategories()
    {
        $filtered = [];
        foreach ($this->categories as $category) {
            if ($category->formula === false) {
                if (null !== $category->examples) {
                    throw new \RuntimeException("The category '{$category->id}' should never occur, but it has examples (so for CLDR it may occur!)");
                }
            } else {
                $filtered[] = $category;
            }
        }
        $this->categories = $filtered;
    }
612145
public function actionManage($category=null) 
	{
		$pageTitle = Yii::t('phrase', 'Menus');
		if($category != null) {
			$data = OmmuMenuCategory::model()->findByPk($category);
			$pageTitle = Yii::t('phrase', 'Menus: category $category_name', array ('$category_name'=>$data->title->message));
		}
		
		$model=new OmmuMenus('search');
		$model->unsetAttributes();	// clear any default values
		if(isset($_GET['OmmuMenus'])) {
			$model->attributes=$_GET['OmmuMenus'];
		}

		$columns = $model->getGridColumn($this->gridColumnTemp());

		$this->pageTitle = $pageTitle;
		$this->pageDescription = '';
		$this->pageMeta = '';
		$this->render('admin_manage', array(
			'model'=>$model,
			'columns' => $columns,
		));
	}