Open redthor opened 6 years ago
I wonder if the better way to deal with the Bundle, is rather than use all those mutators on Configuration
that the Symfony Commands
are ContainerAware
and that they get the mongodb-migrations Configuration
(or something like it) from the container. Then we set up a services.xml
file with classes required.
That way they could be overridden (not sure how useful that would be) by the bundle user. Obviously it'll mean we can remove all the mutators and just get the configuration created once.
Scrutinizer gives
Configuration
class anF
: https://scrutinizer-ci.com/g/doesntmattr/mongodb-migrations/code-structure/master/class/AntiMattr%5CMongoDB%5CMigrations%5CConfiguration%5CConfigurationIt is not hard to see why.
There is this confusing inheritance model:
And there are a bunch of mutators on
Configuration
just so that the bundle can overwrite settings here: https://github.com/doesntmattr/mongodb-migrations-bundle/blob/master/Command/CommandHelper.php#L38Suggest we apply:
ConfigurationBuilder
Configuration
classConfigurationLoader
yaml | xml | container
YamlLoader
XmlLoader
ContainerLoader
VersionCollection
These are just ideas. Would need to look more into how the
Configuration
class is used.Note that improvements here could also improve the Doctrine migrations library https://github.com/doctrine/migrations because it follows the same structure: https://scrutinizer-ci.com/g/doctrine/migrations/code-structure/master/class/Doctrine%5CDBAL%5CMigrations%5CConfiguration%5CConfiguration