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

  1. Create the ConfigurationManagement class.
  2. Replace all the calls to Configuration::* from drush integration and ui with ConfigurationManagement::*
  3. Move the methods from Configuration into ConfigurationManagement.
  4. Make sure tests still pass.
  5. 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::*"

Comments

dagmar’s picture

Status: Active » Needs review
StatusFileSize
new94.63 KB

Small patch :)

dagmar’s picture

StatusFileSize
new4.39 KB
new95.18 KB

Removed some uses of "use Drupal\configuration\Config\Configuration;"

dagmar’s picture

StatusFileSize
new96.05 KB

Updated patch for changes introduced here: #1800020-13: Config directory is not initialized

dagmar’s picture

Status: Needs review » Fixed

Committed 83533de.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.