public function getParentCategory()
    {
        $parentCategory = null;
        $currentCategory = $this->getCurrentCategory();
        if (null !== $currentCategory) {
            $parentCategoryId = $currentCategory->getParentId();
            $parentCategory = $this->_categoryRepository->get(
                $parentCategoryId,
                $this->_storeManager->getStore()->getId()
            );
            if (null !== $parentCategory && 1 >= $parentCategory->getLevel()) {
                $parentCategory = null;
            }
        }
        return $parentCategory;
    }
public function getParentCategory()
    {
        $parentCategory = null;
        $currentCategory = $this->getCurrentCategory();
        if (null !== $currentCategory) {
            $parentCategoryId = $currentCategory->getParentId();
            $parentCategory = $this->_categoryRepository->get(
                $parentCategoryId,
                $this->_storeManager->getStore()->getId()
            );
            if (null !== $parentCategory && 1 >= $parentCategory->getLevel()) {
                $parentCategory = null;
            }
        }
        return $parentCategory;
    }
public function getParentCategory ( ) { $ parentCategory = null ; $ currentCategory = $ this -> getCurrentCategory ( ) ; if ( null !== $ currentCategory ) { $ parentCategoryId = $ currentCategory -> getParentId ( ) ; $ parentCategory = $ this -> _categoryRepository -> get ( $ parentCategoryId , $ this -> _storeManager -> getStore ( ) -> getId ( ) ) ; if ( null !== $ parentCategory && 1 >= $ parentCategory -> getLevel ( ) ) { $ parentCategory = null ; } } return $ parentCategory ; }
get the parent category of the current category

@return Magento\Catalog\Model\Category
| Magento\Catalog\Model\Category\Interceptor
| null
get the parent category of the current category