Unable to get configuration parameters inside a version class file anymore (eg. in method up())
BC Break Report
| Q | A |
|---|---|
| BC Break | yes |
| Version | 3.0.1 |
Summary
I would like to get the "migrations" table name in the version file. This used to work under doctrine migrations 1.8. However, in 3.0.1, this seems to crash.
I checked the upgrades guide, and it mentions that the method is removed, but the alternative solution to use Doctrine\Migrations\Metadata\Storage\MetadataStorageConfiguration#getMetadataStorageConfiguration is not working for me because I am unable to get this configuration class to begin with.
Previous behavior
This will get me the migrations table name defined in my yml configuratoin file.
$migrationsTableName = $this->version->getConfiguration()->getMigrationsTableName();
Current behavior
$this->version is not defined. I also tried looking into the parent classes, and in no where does it define anything related to the migrations configuration. Seems like this has been completely refactored.
How to reproduce
Any version file, in the method up(), just add the following and migrate. It will crash:
$migrationsTableName = $this->version->getConfiguration()->getMigrationsTableName();
You may also try this, and gets undefined variable.
dump($this->version)
Thank you very much guys! Your help is much appreciated!
My guess here to resolve this issue is, to be able to get the dependencyFactory instance inside the version class?
Please excuse me if my understanding is incorrect, and do let me know.
Thank you very much!
https://github.com/doctrine/DoctrineMigrationsBundle/blob/3.0.x/Resources/doc/index.rst#migration-dependencies here you can find some documentation on how to provide extra dependencies to your migrations