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

时间:2014-06-12 12:06:32

标签: php yii yii-migrations

我试图使用yii迁移系统,但是当我执行此命令时,我仍然坚持这个错误:

   ./yiic migrate create basic_data_migrate

我收到此错误:

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

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

1 个答案:

答案 0 :(得分:5)

生成新的迁移文件时,迁移命令正在使用模板创建包含基本说明的php文件。

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

在配置文件中找到类似:

的内容
'commandMap' => array(
        'migrate' => array(
            'class' => 'system.cli.commands.MigrateCommand',
            'migrationPath' => 'application.migrations',
            'templateFile' => 'application.migrations.template'//This should be removed
        )
    ),

然后删除第templateFile