创建新迁移时出现"无法打开流"错误

Dhi*_*h.B 3 php yii yii-migrations

我正在尝试使用yii迁移系统,但是在执行此命令时我遇到了这个错误:

   ./yiic migrate create basic_data_migrate
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

PHP Error[2]: file_get_contents(C:\Bitnami\wappstack-5.4.28-0\apache2\htdocs\cv360\protected\migrations\template.php): failed to open stream: No such file or directory
    in file C:\Bitnami\wappstack-5.4.28-0\apache2\htdocs\yii\framework\cli\commands\MigrateCommand.php at line 555
Run Code Online (Sandbox Code Playgroud)

这是什么template.php?如何解决这个问题呢.

dar*_*eir 5

生成新的迁移文件时,迁移命令使用模板创建包含基本指令的php文件.

默认情况下,Yii使用自己的模板文件,但您可以定义自己的模板文件.在你的情况下,似乎你设置了templateFile参数,但你没有任何模板.

在您的配置文件中找到类似的内容:

'commandMap' => array(
        'migrate' => array(
            'class' => 'system.cli.commands.MigrateCommand',
            'migrationPath' => 'application.migrations',
            'templateFile' => 'application.migrations.template'//This should be removed
        )
    ),
Run Code Online (Sandbox Code Playgroud)

并删除该行 templateFile