Problem/Motivation
The 1.x of this module branch have been almost rewritted from scracth due it has a lot of duplicated code, plus other issues.
Now we have a single class called Configuration that unify a lot of shared functionality between configurations, which is a big win due we can maintain the code. However, there are a lot of static methods that are not being re-implemented, and probably will not be reimplemented in children classes either because they provide generic functionality for all configurations.
This pressent two main issue, first, make bigger the Configuration Class, make it harder to maintain and understand. And secondly, this set of methods probably should be moved into a second class that handle Configurations in groups because they don't really make sense as part of the Configuration Class.
Proposed resolution
For this reasons, I'm proposing to split the Configuration class in two different classes.
class ConfigurationManagement {
static function exportToDataStore();
static function importToActiveStore();
static function restoreFromStaging();
static function exportAsTarFile();
static function createConfigurationHandler();
// And other the helper methods that are static in the original class
}
And
class Configuration {
public saveToActiveStore();
public saveToDataStore();
public loadFromActiveStore();
public build();
public export();
public revert();
public getIdentifier();
static public getAllIdentifiers();
// ....
// And all the current methods without include the moved to ConfigurationManagement
}
Remaining tasks
- Create the ConfigurationManagement class.
- Replace all the calls to Configuration::* from drush integration and ui with ConfigurationManagement::*
- Move the methods from Configuration into ConfigurationManagement.
- Make sure tests still pass.
- Rename tests for API.
User interface changes
None
API changes
Probably only this: "Replace all the calls to Configuration::* from drush integration and ui with ConfigurationManagement::*"
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 1814550.split-configuration-class.3.patch | 96.05 KB | dagmar |
| #2 | 1814550.split-configuration-class.2.patch | 95.18 KB | dagmar |
| #2 | interdiff.txt | 4.39 KB | dagmar |
| #1 | 1814550.split-configuration-class.1.patch | 94.63 KB | dagmar |
Comments
Comment #1
dagmarSmall patch :)
Comment #2
dagmarRemoved some uses of "use Drupal\configuration\Config\Configuration;"
Comment #3
dagmarUpdated patch for changes introduced here: #1800020-13: Config directory is not initialized
Comment #4
dagmarCommitted 83533de.