In my script, I'm retrieving categories like this
$category = $this->_categoryFactory->create();
$storeCategories = $category->getCategories(1, $recursionLevel = 1, false, false, true);
$this->_storeCategories[$cacheKey] = $storeCategories;
$resultArray = [];
foreach($storeCategories as $category) {
$arr = [];
$arr['label'] = $category->getName();
$arr['value'] = $category->getId();
array_push($resultArray, $arr );
}
Then
$category->getName();
&
$category->getId();
work fine for getting category name and ID, but,
$category->getUrl();
does not work for retrieving category URL, I want to know is it a valid method call or what is the correct method get URL of the category?