protected function retrieveCategoryFromQueryString()
    {
        $request = $this->getCurrentRequest();
        $categoryId = $request->get('category_id');
        $categorySlug = $request->get('category_slug');

        if (!$categoryId || !$categorySlug) {
            return null;
        }

        return $this->getCategoryManager()->findOneBy([
            'id' => $categoryId,
            'enabled' => true,
        ]);
    }
protected function retrieveCategoryFromQueryString()
    {
        $request = $this->getCurrentRequest();
        $categoryId = $request->get('category_id');
        $categorySlug = $request->get('category_slug');

        if (!$categoryId || !$categorySlug) {
            return null;
        }

        return $this->getCategoryManager()->findOneBy([
            'id' => $categoryId,
            'enabled' => true,
        ]);
    }
protected function retrieveCategoryFromQueryString ( ) { $ request = $ this -> getCurrentRequest ( ) ; $ categoryId = $ request -> get ( 'category_id' ) ; $ categorySlug = $ request -> get ( 'category_slug' ) ; if ( ! $ categoryId || ! $ categorySlug ) { return null ; } return $ this -> getCategoryManager ( ) -> findOneBy ( [ 'id' => $ categoryId , 'enabled' => true , ] ) ; }
Retrieve Category from its id and slug, if any.

@return CategoryInterface|null
Retrieve Category from its id and slug if any .