1
0
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:
David Grudl
2015-02-25 15:10:48 +01:00
parent 84f9a6fdd8
commit 38aa393dc3

View File

@@ -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'.");
}