Re: [PHP-DEV] Destructor Order

2008-10-23 Thread Richard Quadling
2008/10/22 Ryan Panning <[EMAIL PROTECTED]>: > I've been wondering, is such a thing even possible? Is there a good way to > implement an object destruct order? Here are my thoughts: > > In the class definition, specify what "level" of destruction the objects > should be on. How, I have no idea, I h

Re: [PHP-DEV] Destructor Order

2008-10-23 Thread Arvids Godjuks
I think this should be implemented by user. If you are full OOP in your application, then just register all your objects in some global object (In my case I have a global singelton) and trigger hiv removal at the end of your application. If you have destructors written in every object - they will b

Re: [PHP-DEV] Destructor Order

2008-10-23 Thread Nathan Rixham
Jani Taskinen wrote: Nathan Rixham wrote: just to add it in; in ejb3 in java you have PostConstruct and PreDestroy which are pretty useful; maybe something along the same lines could be implemented in PHP? Or perhaps you should just stick with Java? just a suggestion for some useful func

Re: [PHP-DEV] Destructor Order

2008-10-23 Thread Jani Taskinen
Nathan Rixham wrote: Diogo Galvão wrote: "The destructor method will be called as soon as all references to a particular object are removed or when the object is explicitly destroyed or in any order in shutdown sequence." As far as I understand it if your active record references the PDO instan

Re: [PHP-DEV] Destructor Order

2008-10-23 Thread Nathan Rixham
Diogo Galvão wrote: "The destructor method will be called as soon as all references to a particular object are removed or when the object is explicitly destroyed or in any order in shutdown sequence." As far as I understand it if your active record references the PDO instance (say $this->conn) y

Re: [PHP-DEV] Destructor Order

2008-10-23 Thread Diogo Galvão
"The destructor method will be called as soon as all references to a particular object are removed or when the object is explicitly destroyed or in any order in shutdown sequence." As far as I understand it if your active record references the PDO instance (say $this->conn) your object gets destr

Re: [PHP-DEV] Destructor Order

2008-10-23 Thread Marcus Boerger
Hello Ryan, during 5.0 alpha phase I had that actually implemented. But it turned out to be too much of a slowdown and also could not solve all dependency graphs. For example you can obviously not solve dependency cycles. So at the end of the experiement we decided against it. Maybe we could im

Re: [PHP-DEV] Destructor Order

2008-10-22 Thread Evert | Filemobile
I believe the "end of your script" part is the problem. Imagine you have some object (say, ActiveRecord style) that writes itself to the database when it's destroyed if the data has been modified. Now cache that object in a static variable somewhere for performance. You're also using PDO,

Re: [PHP-DEV] Destructor Order

2008-10-22 Thread Larry Garfield
On Wednesday 22 October 2008 2:31:38 am Mike van Riel wrote: > >> Example destruction order: > >> 3 = database records (ActiveRecord or such) > >> 2 = database connection object > >> 1 = framework objects > >> 0 = objects with unspecified level > > > > Why would you need such thing? > > PHP uses r

Re: [PHP-DEV] Destructor Order

2008-10-22 Thread Stan Vassilev | FM
Hi, Naturally this line: "$this->addObject($this, $priority);" was meant to be: $destructManager->addObject($this, $priority);" ... Regards, Stan Vassilev -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Destructor Order

2008-10-22 Thread Stan Vassilev | FM
On Wed, Oct 22, 2008 at 5:03 AM, Ryan Panning <[EMAIL PROTECTED]> wrote: I've been wondering, is such a thing even possible? Is there a good way to implement an object destruct order? Here are my thoughts: In the class definition, specify what "level" of destruction the objects should be on. Ho

Re: [PHP-DEV] Destructor Order

2008-10-22 Thread Mike van Riel
Alexey Zakhlestin wrote: On Wed, Oct 22, 2008 at 5:03 AM, Ryan Panning <[EMAIL PROTECTED]> wrote: I've been wondering, is such a thing even possible? Is there a good way to implement an object destruct order? Here are my thoughts: In the class definition, specify what "level" of destruction the

Re: [PHP-DEV] Destructor Order

2008-10-21 Thread Alexey Zakhlestin
On Wed, Oct 22, 2008 at 5:03 AM, Ryan Panning <[EMAIL PROTECTED]> wrote: > I've been wondering, is such a thing even possible? Is there a good way to > implement an object destruct order? Here are my thoughts: > > In the class definition, specify what "level" of destruction the objects > should be