so, this is weird, I have this method called treetrunk that runs up a parent child relationship and is supposed to return an array if ids as a "branchPath" - the method seems to be working just fine as a var_dump in my terminating condition shows the proper array. However if i try to call the method the returned array is "NULL" - I really dont get it..
Model method:
function treeTrunk($id){//1st id in is page id
if($id == '0'){
var_dump($this->branchPath); //this shows perfect array
return $this->branchPath; //this returns null
}
else{
$q = $this->getWhere(array('id'=>$id),null,null);
array_push($this->branchPath, $q[0]['pageParent']);
$this->treeTrunk($q[0]['pageParent']);
}
}
Calling via controller:
$d = $this->pages_mdl->treeTrunk('150');
var_dump($d); // <- this == NULL
var_dump from within method outputs "array(3) { [0]=> string(3) "148" [1]=> string(3) "146" [2]=> string(1) "0" } "