I have the following method
function getSectionNumber() {
return $this->section->getSectionID();
}
which should return the section number of the section class object stores in the section variable but its giving the following error
Fatal error: Call to a member function getSectionID() on a non-object in home/smdbs/new.wgcscouts.co.uk/includes/classes/user.php on line 169
Now i can understand the problem if the section variable didn't contain a section class object but it does, as i can do this
function getSectionNumber() {
print "Section Num: " . $this->section->getSectionID();
print "<br/>Class: " . get_class($this->section) . "<br/>";
var_dump($this->section);
print "<br/><br/><strong>Methods</strong>";
$class_methods = get_class_methods($this->section);
foreach ($class_methods as $method_name) {
echo "$method_name\n<br/>";
}
return $this->section->getSectionID();
}
which gives me
Section Num: 6
Class: section
object(section)#23 (2) { ["sectionID":"section":private]=> int(6) ["name":"section":private]=> string(7) "Leaders" }
Methods__construct
getSectionID
getName
Fatal error: Call to a member function getSectionID() on a non-object in /home/smdbs/new.wgcscouts.co.uk/includes/classes/user.php on line 169