I've got a recursive function defined as follows
private function _buildPathwayRecurse(&$category, &$reversePathway = array()) {
$category->uri = FlexicontentHelperRoute::getCategoryRoute($category->id);
$reversePathway[] = $category;
if ($category->parent_id != 0) {
$category = $this->_getCatForPathway($category->parent_id);
$this->_buildPathwayRecurse($category, $reversePathway);
} else {
return $reversePathway;
}
}
and I'm calling it like so
$reversePathway = $this->_buildPathwayRecurse($category);
However $reversePathway ends up being null. Any idea why that is? I've stepped through my code using XDebug and as far as I can tell everything works as it should. When I get to the line
return $reversePathway
$reversePathway looks perfect. It's persisting through the function calls and gaining a new item each time. right before executing the return line it's got an array of a few items just like it should be, but by the time I get out to
$reversePathway = $this->_buildPathwayRecurse($category);
it seems to just dissapear!