Re: AW: [PHP] objects forget about their attributes!
| From: | Jens Kisters | Date: | Tue, 08 Aug 2000 10:08:20 +0000 |
| Subject: | Re: AW: [PHP] objects forget about their attributes! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-10617@lists.php.net to get a copy of this message | ||
> you should take care of the case sensitivity.
> PSubitems != pSubItems
X-)
thats really lame. i messed up the example, sorry.
But case-sensitivity is not the problem i have in my application, i'll copy
the code that gives me Headaches.
item.cls.php4
- cut -
var $pSubItems; //SubItems (-> Recursive)
function mLoadRecursive($ID)
{
$this->mLoadSimple($ID);
while ($m=each($this->pModule->pSubModules))
{
$mod=strtolower($m["value"]["mod"]);
$items=$this->mLoadSubItems($mod); //Get a bunch of objects
while ($i=$items->mNext())
{
$this->pSubItems[$mod][$i->mGet($m["value"]["key"])]=$i; //fill them
in
here
echo $mod.":".$i->mGet($m["value"]["key"]); //this works!!
echo $this->pSubItems[$mod][$i->mGet($m["value"]["key"])];//theres
something in here, too
}
}
//show_var("t",$this->pSubItems);
}
function mGetSubItem($mod,$key)
{
if (!$this->pSubItems[strtolower($mod)][$key]) {
$m=$this->pApp->mLoadModule($mod);
$this->pSubItems[strtolower($mod)][$key]=$m->mGetItem($this);
}
return $this->pSubItems[strtolower($mod)][$key];
}
function mSetSubItem($mod,$key,$i)
{
$this->pSubItems[strtolower($mod)][$key]=$i;
}
- cut -
and the scripts that uses the class
$new is a instance of the object above
- cut -
if ($action=="update")
{
$new->mLoadRecursive($ID);
echo $new->pSubItems;
echo $new->mGetSubItem("somename","anothername");
$action="alter";
}
-cut-
The Method mLoadRecursive fills $this->pSubitem with objects, like in
$this->pSubItem["somename"]["anothername"]=$anobject,
it really does acourding to my debugoutput. i promise!
The name-indices are correct, too.
It just nulls the array pSubItems!!
when i try to access pSubItems via $new->pSubItems or the Get Method i get
nothing.
I doesn't work from inside another method of $new either.
i'm desperate.
--
Grüße aus Weeze
Jens Kisters
rosomm et partner
Holtumsweg 12
47652 Weeze
Telefon: 0 28 37 - 96 23 73
http://www.rosomm-partner.de