I have some classes extended this way:
class Baseresidence extends CActiveRecord {
public static function model($className=__CLASS__) {
return parent::model($className); // framework needs, can't modify
}
}
class Site1Residence extends Baseresidence {
}
and finally
class_alias('Site1Residence', 'Residence'); // this is part of an autoloader
So in the end I have like this Residence extends Site1Residence extends Baseresidence extends CActiveRecord
In the Baseresidence I have a static method model()
which retrieves an instance.
Now I can call::
$r=Residence::model();
The problem is that __CLASS__
constant is used as default value, and that on that level is Baseresidence, and I need there the top level class name (created with the alias) and it should be 'Residence'
if I do:
echo get_class($r); // the Baseresidence is printed
The goal is to print residence
I do not want to pass anything when calling $r=Residence::model();
I would like to resolve it on the roots.
How to get the top level class name on that level?