From: Don S. <do...@se...> - 2003-02-08 23:40:22
|
Came across a stumbling block and need a fresh set of eyes. I have 3 classes in my module (among others). Manager, Item, and Thing. Thing is a set of dynamic fields that could be in item. The Thing class defines the fields, not their values. So I thought it would be best to have my array of Things in the Manager class. So my Manager constructor it calls the sql to get all the things out of the database and populates an array of Thing objects. All is good. Now when the Item needs to get the list of Things to display forms or values it would just get the list like this: $this->mythings = $_SESSION["SES_MODULE_MANAGER"]->getThings(); Manager.getThings is defined as: function getThings() { // Things is the array of Thing object populated in the constructor return $this->_things; } I have echo statements that verify that the array return has the same number of items as the array in the Manager. However when I try to make function calls on the Thing objects in the array from my Item, I get error about call to member object on a non-object. Example would be if I tried this from my Item class: for($i=0; $i<count($this->mythings); $i++) $this->mythings[$i]->renderThing(); I had assumed it was pretty trivial, but can I, in fact, return an array of objects from the session? Don. |