Search code examples
symfonysymfony5

Symfony 5 doctrine_migrations error on script boot


As far as i can tell, i can't see any other questions that ask this, so here goes:

I've been running the latest Symfony, for a side project, and encountered this error as i was writing the app. Nothing i do now fixes it, not even re-installing symfony, and i have no idea what the problem even is. I am getting the error:

The parameter "doctrine_migrations.dir_name" has a dependency on a non-existent parameter "kernel.root_dir". Did you mean one of these: "kernel.project_dir", "kernel.cache_dir", "kernel.logs_dir"?

error encountered


Solution

  • Just to document the root cause.

    Symfony 5 removed kernel.root_dir parameters. Doctrine Migrations Bundle uses it as default value for dir_name.

    It's been discussed. See https://github.com/doctrine/DoctrineMigrationsBundle/issues/305 and https://github.com/doctrine/DoctrineMigrationsBundle/pull/295.

    SOLUTION: right now (Symfony 5 and Migrations bundle 2.1.x), you should not delete doctrine_migrations.yaml. Leave it there with a dir_name that does not raise en error.