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:
[PHP]parent::PagOpti onsView($id, $errorArray);[/PHP]
EditView's constructor will next instantiate an AddView object for
itself:
[PHP]$this->addView =& new AddView($this->id, $this->errorArray);[/PHP]
AddView's constructor will call a "super()" onto AssocView as so:
[PHP]parent::AssocVi ew($id, $errorArray);[/PHP]
PagOptionsView' s constructor instantiates a DBActionPerform er object as
so:
[PHP]$this->dbAP = new DBActionPerform er($id);[/PHP]
AssocView's constructor instantiates a DBActionPerform er object as so:
[PHP]$this->dbAP =& new DBActionPerform er($id);[/PHP]
DBActionPerform er's constructor instantiates a DBConnection object as
so:
[PHP]$this->dbConnObj = new DBConnection($d bHost, $dbPort, $dbUser,
$dbPwd, $dbDefaultName) ;[/PHP]
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:
[PHP]$result = $this->dbAP->select(); // RESULTSET EVERY TIME [/PHP]
However, were I do this, again, in EditView's displayHTML() method:
[PHP]$html .= $this->addView->displayHTML( );
I get the following error:
This occurs because the following doesn't exist as an object:
Whereas this exists:
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
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:
[PHP]parent::PagOpti onsView($id, $errorArray);[/PHP]
EditView's constructor will next instantiate an AddView object for
itself:
[PHP]$this->addView =& new AddView($this->id, $this->errorArray);[/PHP]
AddView's constructor will call a "super()" onto AssocView as so:
[PHP]parent::AssocVi ew($id, $errorArray);[/PHP]
PagOptionsView' s constructor instantiates a DBActionPerform er object as
so:
[PHP]$this->dbAP = new DBActionPerform er($id);[/PHP]
AssocView's constructor instantiates a DBActionPerform er object as so:
[PHP]$this->dbAP =& new DBActionPerform er($id);[/PHP]
DBActionPerform er's constructor instantiates a DBConnection object as
so:
[PHP]$this->dbConnObj = new DBConnection($d bHost, $dbPort, $dbUser,
$dbPwd, $dbDefaultName) ;[/PHP]
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:
[PHP]$result = $this->dbAP->select(); // RESULTSET EVERY TIME [/PHP]
However, were I do this, again, in EditView's displayHTML() method:
[PHP]$html .= $this->addView->displayHTML( );
I get the following error:
...function on a non-object in ...
$this->addView->dbAP->dbConnObj
$this->dbAP->dbConnObj
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
Comment