Call to a member function getDb() on null

Hi all , can you help me .

I use query get data but show error : Call to a member function getDb() on null.

code :

$sql = ‘SELECT * FROM table’;

$model = Languages::findBySql($sql)->all();

but show error Fatal error: Call to a member function getDb() on null in vendor\yiisoft\yii2\db\ActiveRecord.php on line 133.

How to I can fix error.

You can set up the db component ?

thank