mirror of
https://github.com/dg/dibi.git
synced 2025-08-07 14:46:50 +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.
|
* Creates a new DibiConnection object and connects it to specified database.
|
||||||
* @param mixed connection parameters
|
* @param mixed connection parameters
|
||||||
|
* @param string connection name
|
||||||
* @return DibiConnection
|
* @return DibiConnection
|
||||||
* @throws DibiException
|
* @throws DibiException
|
||||||
*/
|
*/
|
||||||
public static function connect($config = array(), $name = 0)
|
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);
|
return self::$connection = self::$registry[$name] = new DibiConnection($config, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,6 +118,7 @@ class dibi
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve active connection.
|
* Retrieve active connection.
|
||||||
|
* @param string connection registy name
|
||||||
* @return DibiConnection
|
* @return DibiConnection
|
||||||
* @throws DibiException
|
* @throws DibiException
|
||||||
*/
|
*/
|
||||||
@@ -133,8 +132,6 @@ class dibi
|
|||||||
return self::$connection;
|
return self::$connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger_error(__METHOD__ . '(): named connections are deprecated.', E_USER_DEPRECATED);
|
|
||||||
|
|
||||||
if (!isset(self::$registry[$name])) {
|
if (!isset(self::$registry[$name])) {
|
||||||
throw new DibiException("There is no connection named '$name'.");
|
throw new DibiException("There is no connection named '$name'.");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user