Commit with composer.json
This commit is contained in:
14
model/Db.php
14
model/Db.php
@ -7,6 +7,8 @@
|
||||
* @since 2010-02-16
|
||||
*/
|
||||
|
||||
namespace Majestic;
|
||||
|
||||
class Db
|
||||
{
|
||||
|
||||
@ -35,14 +37,14 @@ class Db
|
||||
{
|
||||
if (!isset(self::$connections[$name])) {
|
||||
if (!$config) {
|
||||
if (!is_object(Config::get(__CLASS__))) {
|
||||
throw new InitializationException('Trying to get property of non-object');
|
||||
if (!is_object(\Majestic\Config::get(__CLASS__))) {
|
||||
throw new \InitializationException('Trying to get property of non-object');
|
||||
}
|
||||
$config = Config::get(__CLASS__)->$name;
|
||||
$config = \Majestic\Config::get(__CLASS__)->$name;
|
||||
}
|
||||
|
||||
if (!is_array($config)) {
|
||||
throw new InitializationException('Connection parameters must be an array');
|
||||
throw new \InitializationException('Connection parameters must be an array');
|
||||
}
|
||||
|
||||
$driver = 'MySQLiDriver';
|
||||
@ -53,8 +55,8 @@ class Db
|
||||
|
||||
$connection = new $driver($config);
|
||||
|
||||
if (!$connection instanceof DbDriver) {
|
||||
throw new InitializationException('Database driver must extends DbDriver');
|
||||
if (!$connection instanceof \DbDriver) {
|
||||
throw new \InitializationException('Database driver must extends DbDriver');
|
||||
}
|
||||
self::$connections[$name] = $connection;
|
||||
}
|
||||
|
Reference in New Issue
Block a user