Hey Torsten,
Torsten Roehr wrote:
$persons = Person::load($sql); // returns collection of Person objects $cars = Car::load($sql); // returns collection of Car objects
Simple solutions:
1) $persons = DB::load('Person', $sql); foreach ($persons as $person)...
2) $person = new Person($sql); while ($person->iterate())...
3) Adding get_class() to all DB classes (like Person) as suggested by Daniel Convissor.
Solution 1) is IMHO close enough to your solution. Personally I prefer (and we are using) solution 2) here as it also is more space efficient for large number of results returned from the DB (only one Person object is needed). On top of that we create classes automatically at runtime from DB tables which removed the need to write stub classes (and makes solution 3) feasible again).
I suggest that we take this discussion off-line now as it is not really an internals discussion anymore.
- Chris
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php