Do it:
class A{
public $modelName = 'B';
function callB(){
call_user_func(array($this->modelName, 'model'))->findAll();
}
}
class B{
private static $model = null;
static function model(){
if (!self::$model) {
self::$model = new B();
}
return self::$model;
}
function findAll(){
print __CLASS__.' method `findAll()`';
}
}
$A = new A;
$A->callB();
// B method `findAll()`