I'm having a serious problem in my application I simply cannot seem to fix, and it has to do with multiple inheritances whereby something is lost.
Class EditView is a child of PagOptionsView
Class Addview is a child of AssocView
EditView's constructor will call a "super()" onto PagOptionsView as so:
parent::PagOptionsView($id, $errorArray);
EditView's constructor will next instantiate an AddView object for itself:
$this->addView =& new AddView($this->id, $this->errorArray);
AddView's constructor will call a "super()" onto AssocView as so:
parent::AssocView($id, $errorArray);
PagOptionsView's constructor instantiates a DBActionPerformer object as so:
$this->dbAP = new DBActionPerformer($id);
AssocView's constructor instantiates a DBActionPerformer object as so:
$this->dbAP =& new DBActionPerformer($id);
DBActionPerformer's constructor instantiates a DBConnection object as so:
$this->dbConnObj = new DBConnection($dbHost, $dbPort, $dbUser, $dbPwd, $dbDefaultName);
Now, when I instantiate an EditView object, I have a method, displayHTML() that will display HTML of stuff. I can do this and everything works beautifully:
$result = $this->dbAP->select(); // RESULTSET EVERY TIME
However, were I do this, again, in EditView's displayHTML() method:
$html .= $this->addView->displayHTML();
I get the following error:
[Quote]...function on a non-object in ...[/Quote]
This occurs because the following doesn't exist as an object:
[Quote]$this->addView->dbAP->dbConnObj[/Quote]
Whereas this exists:
[Quote]$this->dbAP->dbConnObj[/Quote]
What is going on? The DBConnection object is somehow nonexistent in one method of inheritance but found in another. I need someone who really REALLY knows their OO PHP (or can fake it good enough) to help me with this one, I'm totally stuck!
Thanx
Phil