class DatabaseAdapterRegistry implements Flushable (View source)

This class keeps track of the available database adapters and provides a meaning of registering community built adapters in to the installer process.

Properties

Methods

public static 
register(array $config)

Add new adapter to the registry

public static 
unregister(string $class)

Unregisters a database connector by classname

public static 
autodiscover()

Detects all _register_database.php files and invokes them.

public static 
autoconfigure(array $config = null)

Detects all _configure_database.php files and invokes them Called by ConfigureFromEnv.php.

protected static 
array
getConfigureDatabasePaths()

Including _configure_database.php is a legacy method of configuring a database It's still used by https://github.com/silverstripe/silverstripe-sqlite3

public static 
CacheInterface
getCache()

No description

public static 
flush()

This function is triggered early in the request if the "flush" query parameter has been set. Each class that implements Flushable implements this function which looks after it's own specific flushing functionality.

public static 
array
get_adapters()

Return all registered adapters

public static 
array
get_adapter(string $class)

Returns registry data for a class

public static 
array
get_default_fields()

Retrieves default field configuration

public static 
getDatabaseConfigurationHelper(string $databaseClass)

Build configuration helper for a given class

Details

static register(array $config)

Add new adapter to the registry

Parameters

array $config

Associative array of configuration details. This must include:

  • title
  • class
  • helperClass
  • supported This SHOULD include:
  • fields
  • helperPath (if helperClass can't be autoloaded via psr-4/-0)
  • missingExtensionText
  • module OR missingModuleText

static unregister(string $class)

Unregisters a database connector by classname

Parameters

string $class

static autodiscover()

Detects all _register_database.php files and invokes them.

Searches through vendor/\/ folders only, does not support "legacy" folder location in webroot

static autoconfigure(array $config = null)

Detects all _configure_database.php files and invokes them Called by ConfigureFromEnv.php.

Searches through vendor/ folder only, does not support "legacy" folder location in webroot

Parameters

array $config

Config to update. If not provided fall back to global $databaseConfig. In 5.0.0 this will be mandatory and the global will be removed.

static protected array getConfigureDatabasePaths()

Including _configure_database.php is a legacy method of configuring a database It's still used by https://github.com/silverstripe/silverstripe-sqlite3

Return Value

array

static CacheInterface getCache()

No description

Return Value

CacheInterface

static flush()

This function is triggered early in the request if the "flush" query parameter has been set. Each class that implements Flushable implements this function which looks after it's own specific flushing functionality.

static array get_adapters()

Return all registered adapters

Return Value

array

static array get_adapter(string $class)

Returns registry data for a class

Parameters

string $class

Return Value

array

List of adapter properties

static array get_default_fields()

Retrieves default field configuration

Return Value

array

static DatabaseConfigurationHelper|null getDatabaseConfigurationHelper(string $databaseClass)

Build configuration helper for a given class

Parameters

string $databaseClass

Name of class

Return Value

DatabaseConfigurationHelper|null

Instance of helper, or null if cannot be loaded