mirror of
https://github.com/dg/dibi.git
synced 2025-08-04 21:28:02 +02:00
dibi: named connections and activate() are deprecated (BC break)
This commit is contained in:
@@ -86,12 +86,14 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +120,6 @@ class dibi
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve active connection.
|
* Retrieve active connection.
|
||||||
* @param string connection registy name
|
|
||||||
* @return DibiConnection
|
* @return DibiConnection
|
||||||
* @throws DibiException
|
* @throws DibiException
|
||||||
*/
|
*/
|
||||||
@@ -132,6 +133,8 @@ 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'.");
|
||||||
}
|
}
|
||||||
@@ -152,13 +155,11 @@ class dibi
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change active connection.
|
* @deprecated
|
||||||
* @param string connection registy name
|
|
||||||
* @return void
|
|
||||||
* @throws DibiException
|
|
||||||
*/
|
*/
|
||||||
public static function activate($name)
|
public static function activate($name)
|
||||||
{
|
{
|
||||||
|
trigger_error(__METHOD__ . '() is deprecated.', E_USER_DEPRECATED);
|
||||||
self::$connection = self::getConnection($name);
|
self::$connection = self::getConnection($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user