mirror of
https://github.com/dg/dibi.git
synced 2025-08-05 05:37:39 +02:00
dibi: named connections are allowed [Closes #161]
Partially reverts commit a923ce7ecb
.
This commit is contained in:
@@ -86,14 +86,12 @@ class dibi
|
||||
/**
|
||||
* Creates a new DibiConnection object and connects it to specified database.
|
||||
* @param mixed connection parameters
|
||||
* @param string connection name
|
||||
* @return DibiConnection
|
||||
* @throws DibiException
|
||||
*/
|
||||
public static function connect($config = array(), $name = 0)
|
||||
{
|
||||
if ($name) {
|
||||
trigger_error(__METHOD__ . '(): named connections are deprecated.', E_USER_DEPRECATED);
|
||||
}
|
||||
return self::$connection = self::$registry[$name] = new DibiConnection($config, $name);
|
||||
}
|
||||
|
||||
@@ -120,6 +118,7 @@ class dibi
|
||||
|
||||
/**
|
||||
* Retrieve active connection.
|
||||
* @param string connection registy name
|
||||
* @return DibiConnection
|
||||
* @throws DibiException
|
||||
*/
|
||||
@@ -133,8 +132,6 @@ class dibi
|
||||
return self::$connection;
|
||||
}
|
||||
|
||||
trigger_error(__METHOD__ . '(): named connections are deprecated.', E_USER_DEPRECATED);
|
||||
|
||||
if (!isset(self::$registry[$name])) {
|
||||
throw new DibiException("There is no connection named '$name'.");
|
||||
}
|
||||
|
Reference in New Issue
Block a user