Re: __Destruct() functionality
| From: | Gareth Ardron | Date: | Tue, 29 Jun 2004 23:50:55 +0000 |
| Subject: | Re: __Destruct() functionality | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-10839@lists.php.net to get a copy of this message | ||
On Tue, 2004-06-29 at 18:55, Marcus Boerger wrote:
> Hello Florian,
>
> there is no problem in calling resource destructors/terminators in your
> destructors. You simply cannot output text to your pages from them. If
> this is not true then we need to fix it. For example if an object of
> yours holds a database connection and your destructor executes some
> SQL code this must work. Open a bug report if necessary.
Does the examples I gave you before not count ?
To reiterate:
<?php
// db in this sense is an already initialised database class
// basic wrappers around the mysql functions in my case.
class logger extends db {
function logEvent($msg){
// somecode here which uses the parent db class
// to write the msg to a database
}
}
class someOtherClass {
public $log;
function __destruct(){
$log->logEvent("leaving someOtherClass");
}
}
$log = new logger;
$soc = new someOtherClass;
$soc->log = $log;
?>
in this case, the __destruct() function within someOtherClass does
absolutly bugger all.