我在文件夹前端/迁移中有以下课程
use yii\db\Schema;
class m170727_180101_Bewerbungen extends \yii\db\Migration
{
public function safeUp()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable('bewerbungen', [
'bew_id' => $this->primaryKey(),
'datum' => $this->date()->notNull(),
'firma' => $this->string(100)->notNull(),
'rechtsart' => $this->integer(11),
'stadt' => $this->string(100)->notNull(),
'plz' => $this->integer(11)->notNull(),
'strasse_nr' => $this->string(100),
'ansprech_person' => $this->string(100),
'email' => $this->string(50)->notNull(),
'feedback' => $this->integer(11),
'bemerkungen' => $this->string(150),
'FOREIGN KEY ([[feedback]]) REFERENCES nachricht ([[id_message]]) ON DELETE CASCADE ON UPDATE CASCADE',
'FOREIGN KEY ([[rechtsart]]) REFERENCES rechtsform ([[id_recht]]) ON DELETE CASCADE ON UPDATE CASCADE',
], $tableOptions);
}
public function safeDown()
{
$this->dropTable('bewerbungen');
}
}
每次尝试读取方法safeUp()都会抛出错误:
在以下文件中找不到“frontend\migrations\m170727\u 180101\u Bewerbungen”:E:\xampp\htdocs\Yii2\u Mail/frontend/migrations/m170727\u 180101\u Bewerbungen.php。命名空间缺失**
namespace frontend\migrations; ...
$connect=new m170727_180101_Bewerbungen();
$connect->safeUp(); ...
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
这到底是什么?
同样的错误如下:
$connect=new \frontend\migrations\m170727_180101_Bewerbungen();