\ConfigDatabase

Database Configuration

Not intended to be used on its own, this class will attempt to automatically populate the child class' properties with values from the environment.

These can be set within the .env file.

Summary

Methods
Properties
Constants
connect()
getConnections()
forge()
utils()
seeder()
__construct()
$registrars
$filesPath
$defaultGroup
$default
No constants found
ensureFactory()
initEnvValue()
getEnvValue()
registerProperties()
$instances
$factory
$didDiscovery
$moduleConfig
N/A
No private methods found
No private properties found
N/A

Properties

$registrars

$registrars : array

An optional array of classes that will act as Registrars for rapidly setting config class properties.

Type

array

$filesPath

$filesPath : string

The directory that holds the Migrations and Seeds directories.

Type

string

$defaultGroup

$defaultGroup : string

Lets you choose which connection group to use if no other is specified.

Type

string

$default

$default : array

The default database connection.

Type

array

$instances

$instances : array

Cache for instance of any connections that have been requested as a "shared" instance.

Type

array

$factory

$factory : \CodeIgniter\Database\Database

The main instance used to manage all of our open database connections.

Type

\CodeIgniter\Database\Database

$didDiscovery

$didDiscovery : boolean

Has module discovery happened yet?

Type

boolean

$moduleConfig

$moduleConfig : \CodeIgniter\Config\type

The modules configuration.

Type

\CodeIgniter\Config\type

Methods

connect()

connect(string|array  $group = null, boolean  $getShared = true) : \CodeIgniter\Database\BaseConnection

Creates the default

Parameters

string|array $group

The name of the connection group to use, or an array of configuration settings.

boolean $getShared

Whether to return a shared instance of the connection.

Returns

\CodeIgniter\Database\BaseConnection

getConnections()

getConnections() : array

Returns an array of all db connections currently made.

Returns

array

forge()

forge(string|array|null  $group = null) : \CodeIgniter\Database\Forge

Loads and returns an instance of the Forge for the specified database group, and loads the group if it hasn't been loaded yet.

Parameters

string|array|null $group

Returns

\CodeIgniter\Database\Forge

utils()

utils(string|array|null  $group = null) : \CodeIgniter\Database\BaseUtils

Returns a new instance of the Database Utilities class.

Parameters

string|array|null $group

Returns

\CodeIgniter\Database\BaseUtils

seeder()

seeder(string|null  $group = null) : \CodeIgniter\Database\Seeder

Returns a new instance of the Database Seeder.

Parameters

string|null $group

Returns

\CodeIgniter\Database\Seeder

__construct()

__construct() 

ensureFactory()

ensureFactory() 

Ensures the database Connection Manager/Factory is loaded and ready to use.

initEnvValue()

initEnvValue(  $property, string  $name, string  $prefix, string  $shortPrefix) : mixed

Initialization an environment-specific configuration setting

Parameters

$property
string $name
string $prefix
string $shortPrefix

Returns

mixed

getEnvValue()

getEnvValue(string  $property, string  $prefix, string  $shortPrefix) : mixed

Retrieve an environment-specific configuration setting

Parameters

string $property
string $prefix
string $shortPrefix

Returns

mixed

registerProperties()

registerProperties() 

Provides external libraries a simple way to register one or more options into a config file.

Throws

\ReflectionException