Usage:
Gets the names of all available configurations
$configurations = Connections::get();
Gets the configuration array for the connection named 'db'
$config = Connections::get('db', array('config' => true));
Gets the instance of the connection object, configured with the settings defined for
this object in Connections::add()
$dbConnection = Connections::get('db');
Gets the connection object, but only if it has already been built.
Otherwise returns null.
$dbConnection = Connections::get('db', array('autoCreate' => false));
public static get ( string $name = null, array $options = [] ) : mixed | ||
$name | string | The name of the connection to get, as defined in the first parameter of `add()`, when the connection was initially created. |
$options | array | Options to use when returning the connection: - `'autoCreate'`: If `false`, the connection object is only returned if it has already been instantiated by a previous call. - `'config'`: If `true`, returns an array representing the connection's internal configuration, instead of the connection itself. |
return | mixed | A configured instance of the connection, or an array of the configuration used. |