本文介绍了原则迁移:在“”中没有定义任何命令。命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有doctrine-migrations.phar和migrations.yml,我试图将Doctrine Migrations设置为一个独立的程序。在同一个文件夹中。



migrations.yml包含以下内容:

 名称:Doctrine沙箱迁移
migrations_namespace:DoctrineMigrations
table_name:doctrine_migration_versions
migrations_directory:/ home / myusername / myproject /数据库/更新

Inside / home / myusername / myproject /数据库/更新我有一个名为Version20130608161001.php的文件,其中包含以下内容:

 命名空间DoctrineMigrations; 

使用Doctrine\DBAL\Migrations\AbstractMigration;
使用Doctrine\DBAL\Schema\Schema;

class Version20130608161001 extends AbstractMigration
{
public function up(Schema $ schema)
{
echoTest;
}

public function down(Schema $ schema)
{

}
}

当我运行命令:

  php doctrine-migrations.phar -v:migrate 

我收到以下错误消息:

  [InvalidArgumentException] 
命名空间中没有定义任何命令。

异常跟踪:
()在phar:///home/myusername/Desktop/Doctrine/doctrine-migrations.phar/Symfony/Component/Console/Application.php:441
Symfony\Component\Console\Application-> findnamespace()在phar:/// home / myusername / Desktop / Doctrine / doctrine- migrations.phar / Symfony / Component / Console / Application.php:468
Symfony\Component\Console\Application-> findCommand()在phar:///home/myusername/Desktop/Doctrine/doctrine-migrations.phar/Symfony/Component/Console/Application.php:184
Symfony\Component\Console\Application-> doRun()在phar:///home/myusername/Desktop/Doctrine/doctrine-migrations.phar/Symfony/Component/Console/Application.php: 113
Symfony\Component\Console\Application-> run()在/home/myusername/Desktop/Doctrine/doctrine-migrations.phar:59


解决方案

刚刚有同样的问题....



你可以运行comm并且如下所示:

  ./ doctrine-migrations迁移:迁移


I'm trying to setup Doctrine Migrations as a standalone program and am having a little bit of trouble.

I have doctrine-migrations.phar and migrations.yml in the same folder.

migrations.yml contains the following:

name: Doctrine Sandbox Migrations
migrations_namespace: DoctrineMigrations
table_name: doctrine_migration_versions
migrations_directory: /home/myusername/myproject/Database/Update

Inside /home/myusername/myproject/Database/Update I have a file called Version20130608161001.php which contains the following:

namespace DoctrineMigrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

class Version20130608161001 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        echo "Test";
    }

    public function down(Schema $schema)
    {

    }
}

When I run the command:

php doctrine-migrations.phar -v :migrate 

I get the following error message:

[InvalidArgumentException]
There are no commands defined in the "" namespace.

Exception trace:
 () at phar:///home/myusername/Desktop/Doctrine/doctrine-migrations.phar/Symfony/Component/Console/Application.php:441
 Symfony\Component\Console\Application->findNamespace() at phar:///home/myusername/Desktop/Doctrine/doctrine-     migrations.phar/Symfony/Component/Console/Application.php:468
 Symfony\Component\Console\Application->findCommand() at phar:///home/myusername/Desktop/Doctrine/doctrine-migrations.phar/Symfony/Component/Console/Application.php:184
 Symfony\Component\Console\Application->doRun() at phar:///home/myusername/Desktop/Doctrine/doctrine-migrations.phar/Symfony/Component/Console/Application.php:113
 Symfony\Component\Console\Application->run() at /home/myusername/Desktop/Doctrine/doctrine-migrations.phar:59
解决方案

Just had this same problem....

You can run the command as follows:

./doctrine-migrations migrations:migrate

这篇关于原则迁移:在“”中没有定义任何命令。命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 17:50