【发布时间】:2013-05-20 08:29:11
【问题描述】:
我正在尝试在 silex 框架之上设置学说迁移。我是通过 composer 安装的。
"doctrine/dbal": "2.3.*",
"doctrine/migrations": "dev-master",
我的控制台文件:
...
$app['composer_loader']->add('Doctrine\DBAL\Migrations', __DIR__.'/../vendor/doctrine/migrations/lib/');
$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
"db" => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($app['db']),
"dialog" => new \Symfony\Component\Console\Helper\DialogHelper(),
));
$console->setHelperSet($helperSet);
$console->addCommands(array(
// Migrations Commands
new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand(),
new \Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand(),
new \Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand(),
new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand(),
new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand(),
new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand()
));
$console->run();
但是当我运行迁移时:状态它输出:
C:\htdocs\bitvenda\app>php console.php migrations:status
[Doctrine\DBAL\Migrations\MigrationException]
Migrations namespace must be configured in order to use Doctrine migrations
.
我做错了什么?
【问题讨论】:
-
Dextervip,看看 [this other issue][1],它可能会解决您的问题。 [1]:stackoverflow.com/questions/10620794/…
-
@medina 你说得对,我错过了。谢谢你。你知道有没有办法设置配置文件的默认路径?
-
太棒了!我注意到你自己想出来了..玩得开心! =)
标签: php doctrine silex doctrine-migrations