/** * Get category instance applicable for generatePath * * @param \Magento\UrlRewrite\Model\UrlRewrite $model * @return Category|null */ protected function _getInitializedCategory($model) { /** @var $category Category */ $category = $this->_getCategory(); if ($category->getId()) { $model->setCategoryId($category->getId()); } else { $category = null; } return $category; }