objects destroyed in same order as created?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all

I am currently working on a PHP 5 application. For the sake of simplicity, I'll only describe 3 classes here, as that is all that is required for you to see my problem.

I have a DB class that interacts with the database, a Session class that controls the session with the user, and a User class that stores the information about the logged-in user.

I create instances of these classes in the order [DB, Session, User] at request startup. They have to be in this order as the Session and User classes need the database, and the User class needs the session.

The User and Session destructors both need the database to write any changed information back to the database, but it seems that the destructors are called in the order that the objects are created, so the database is taken down first.

Wouldn't it make more sense for just about all applications to destroy objects in the reverse order that they were created? Is there any way to work around this?

Jasper

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux