yii2 gives error 'class cannot be found' with variable name

hi guys!

It seems very easy but…

It gives error ‘class ‘orders’ cannot be found’ when I try to do so:

 $value = 'orders';

 $model = $value::findOne($id);

I guess in Yii 1.1 it works perfectly, isn’t it?

Thank you in advance

Use namespace like a

$value = ‘app\models\Order’;

$model = $value::findOne(1);

$value = Orders::classname();

I feel so shamed ;) thank you much Ksetrin, I swear I felt it should be very easy - thanks again!

tolich, you can also use ::classname() function as I showed above (;