Re: Get name of extending class with static method call (PHP5)
| From: | Christian Schneider | Date: | Wed, 12 Jan 2005 20:04:53 +0000 |
| Subject: | Re: Get name of extending class with static method call (PHP5) | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-14367@lists.php.net to get a copy of this message | ||
Hey Torsten,
Torsten Roehr wrote:
$persons = Person::load($sql); // returns collection of Person objectsSimple 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$cars = Car::load($sql); // returns collection of Car objects