Static Member Variables holding objects w/methods

From: Date: Wed, 16 Aug 2006 14:13:27 +0000
Subject: Static Member Variables holding objects w/methods
Groups: php.general 
Request: Send a blank email to php-general+get-240770@lists.php.net to get a copy of this message
I'm trying to use the following method of a class (DbConnector): public function closeConnector() {
     //
     echo "<p>in closeConnector()";
     var_dump(DbConnector::$connector);
     echo "</p>";
//make sure the db object is cleaned up properly if ( gettype(DbConnector::$connector) == 'object' ) { echo "<br><br>close the ADOdb connection<br><br>"; DbConnector::$connector->Close(); }
     //put things back the way they were found
     $this->connector = false;
} DbConnector is meant to be a singleton class that manages an ADOdb object. However, when the code executes and it gets to this line: DbConnector::$connector->Close(); the script fails and says "Call to undefined method DbConnector::Close()" Is trying to call the Close() method of the static member var (which holds an ADOdb object) not possible?

« previous php.general (#240770) next »