"Christian Schneider" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Torsten Roehr wrote: > > Something so straightforward and fundamental should be possible!?! > > Maybe is isn't as fundamental as you think? I never came across this > problem in years of PHP programming. But then again I use classes with > static calls for nothing but separate namespaces :-) > > I'm pretty sure there is another (possibly more elegant) solution. This > is not a flame but a suggestion to rethink the problem you are trying to > solve. > > - Chris
Hi Chris, no problem - not feeling flamed here ;) Maybe I should elaborate a bit more what I'm needing this for. I would like to write a load method in a superclass that can be used by all subclasses. I'm just passing in the SQL statement as a parameter. The load method commits the query, loops through the result set and creates/returns a collection of objects. The method needs to know the name of the class to create objects of this class. Example: $persons = Person::load($sql); // returns collection of Person objects $cars = Car::load($sql); // returns collection of Car objects All classes can use the same load method and the database access (for selects) is only needed in this method and can therefore be changed easily. It's a bit simplified but I hope you get the idea. Also from the heated discussion on php-general you can see that there are quite a few people facing the described problem. Best regards, Torsten Roehr -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php