CommerceWeavers/SyliusSaferpayPlugin

It seems to be not good idea to use generic namespace "DoctrineMigration" in plugins

Closed this issue · 0 comments

It seems to be not good idea to use generic namespace "DoctrineMigration" in plugins:

What is problem?

If two plugins use the same migration namespace then only one is executed.

Why?

Because migrations are indexed by namespace. See Doctrine\Migrations\FilesystemMigrationsRepository::loadMigrationsFromDirectories

private function loadMigrationsFromDirectories(): void
    {
        $migrationDirectories = $this->migrationDirectories;

        if ($this->migrationsLoaded) {
            return;
        }

        $this->migrationsLoaded = true;

        foreach ($migrationDirectories as $namespace => $path) {
                $migrations = $this->migrationFinder->findMigrations(
                    $path,
                    $namespace
                );
                $this->registerMigrations($migrations);
        }
    }

Possible solution

Use namespace of the plugin as migration namespace