我正在尝试将 Doctrine Migrations 设置为独立程序,但遇到了一些麻烦。
我在同一个文件夹中有教义-migrations.phar 和 migrations.yml。
migrations.yml 包含以下内容:
name: Doctrine Sandbox Migrations
migrations_namespace: DoctrineMigrations
table_name: doctrine_migration_versions
migrations_directory: /home/myusername/myproject/Database/Update
在 /home/myusername/myproject/Database/Update 我有一个名为 Version20130608161001.php 的文件,其中包含以下内容:
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)
{
}
}
当我运行命令时:
php doctrine-migrations.phar -v :migrate
我收到以下错误消息:
[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