Sonata\ProductBundle\Controller\CatalogController::retrieveCategoryFromQueryString PHP Method

retrieveCategoryFromQueryString() protected method

Retrieve Category from its id and slug, if any.
protected retrieveCategoryFromQueryString ( ) : Sonata\ClassificationBundle\Model\CategoryInterface | null
return Sonata\ClassificationBundle\Model\CategoryInterface | null
    protected function retrieveCategoryFromQueryString()
    {
        $categoryId = $this->getRequest()->get('category_id');
        $categorySlug = $this->getRequest()->get('category_slug');
        if (!$categoryId || !$categorySlug) {
            return;
        }
        return $this->getCategoryManager()->findOneBy(array('id' => $categoryId, 'enabled' => true));
    }