Active record model extending another

Hello,

Can an ActiveRecord model extend another ActiveRecord model?

Or it should be accessed using relation only?




Class A extends ActiveRecord{


public static function tableName(){

return 'a_table;

}


}


Class B extends A{


public static function tableName(){

return 'b_table;

}


}



Yes. Sometimes it’s a good pattern.

But Is it possible? I guess not. For example, both the classes will have a static tableName() function.

What will the child class return for below static function: Will it return child table or parent table?




class Parent{

 public static function tableName() {

        return 'parent_table';

    }

}


class Child extends parent{

 public static function tableName() {

        return 'child_table';

    }

}


Child::tableName();



Child::tableName() will return ‘child_table’.

http://php.net/manual/en/language.oop5.basic.php