Odd problem with DB_DataObject
| From: | Phil Gyford | Date: | Mon, 24 Jan 2005 10:26:40 +0000 |
| Subject: | Odd problem with DB_DataObject | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-17124@lists.php.net to get a copy of this message | ||
Hi,
Hopefully this is a really stupid mistake on my part, but I'm
stumped... I've narrowed my problem down to this simple test case:
class TestClass extends DB_DataObject
{
function TestClass()
{
$this->testvar = 'hello world';
}
function testMethod()
{
}
}
$TESTOBJ = new TestClass();
var_dump($TESTOBJ);
$TESTOBJ->testMethod();
var_dump($TESTOBJ);
When var_dump() is called the first time, the object's contents are
displayed as you'd expect, with $testvar included. However, after
calling testMethod(), the second var_dump() simply displays 'NULL'. I
can't work out what's happening there to destroy the object.
If I remove 'extends DB_DataObject' this test case works fine
(outputting the object with $testvar included both times), so it's
obviously something in DB_DataObject that I'm not fully grasping...
Can anyone put me out of my misery? Many thanks...
Phil