note 74491 deleted from function.get-class by cmb
| From: | cmb@php.net | Date: | Wed, 30 Nov 2016 16:32:27 +0000 |
| Subject: | note 74491 deleted from function.get-class by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207756@lists.php.net to get a copy of this message | ||
Note Submitter: Marc W.
----
The previous comment (from matsgefvert dot se) is 100% correct. To further elaborate on the
persistence layers example suggested, consider the case where you are dynamically creating inherited
objects. For example:
<?php
class PersistedObject {
//...
public static function read($key){
//You will need the table name here to actually read
// from the persistence medium
echo get_class();
}
class SomeTable extends PersistedObject {
//...
}
/*
Somewhere else in our code we would like to call the read method
*/
$someTableObject = SomeTable::read(1234);
?>
Remember that the SomeTable class would be generated on the fly, probably by some DB schema. The
problem is that you would actually like the above example to output "SomeTable", but
unfortunately, it will output "PersistedObject".