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