Doctrine Migrations: Missing Commands in the "" Namespace

I'm trying to configure Doctrine Migrations as a standalone program, and I'm having a 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 that 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 

The following error message appears:

 [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 
+4
source share
2 answers

This problem had only one problem.

You can execute the command as follows:

 ./doctrine-migrations migrations:migrate 
0
source

You can change your composer.json as follows:

 { "require": { "doctrine/doctrine-migrations-bundle": "dev-master" } } 

And then update: * Make sure you have the latest stable version of SF in composer.json, at this point 3.3.0

 composer update 

Finally, be sure to include the package in AppKernel.php:

 new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), 
0
source

Source: https://habr.com/ru/post/1485228/


All Articles