Yii2命名空间自动加载器找不到复制的文件

I am running the Yii2 framework locally, and I want to reuse an model I created in a earlier project.

So I copy the file TestForm.php to the models directory, change the namespaces from namespace backend\models to namespace app\models and try to create an object from it with:

$model = new \app\models\TestForm;

Which gives me

Unable to find 'app\models\TestForm' in file: /var/www/html/operators/basic/models/TestForm.php. Namespace missing?

Which is weird because the namespace is correct.

However, if I create the file TestForm.php myself and copy the contents of the older file over, everything works fine.

What's going on? (I use ubuntu 15.04)

I think in your /models/TestForm.php you don't have specified the correct namespace eg :

 namespace basic\models;