From a923ce7ecbd8db2c8ea0448d8056be584fe63fca Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 13 Jan 2015 06:49:49 +0100 Subject: [PATCH] dibi: named connections and activate() are deprecated (BC break) --- dibi/libs/Dibi.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dibi/libs/Dibi.php b/dibi/libs/Dibi.php index d8148a75..4802fd19 100644 --- a/dibi/libs/Dibi.php +++ b/dibi/libs/Dibi.php @@ -86,12 +86,14 @@ 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); } @@ -118,7 +120,6 @@ class dibi /** * Retrieve active connection. - * @param string connection registy name * @return DibiConnection * @throws DibiException */ @@ -132,6 +133,8 @@ 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'."); } @@ -152,13 +155,11 @@ class dibi /** - * Change active connection. - * @param string connection registy name - * @return void - * @throws DibiException + * @deprecated */ public static function activate($name) { + trigger_error(__METHOD__ . '() is deprecated.', E_USER_DEPRECATED); self::$connection = self::getConnection($name); }