Atualizar 'src/BBOrm/Connections.php'
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace BBOrm;
|
||||
|
||||
class Connections {
|
||||
|
||||
private static $_connections;
|
||||
private $connections = Array();
|
||||
|
||||
private function __construct() {
|
||||
|
||||
}
|
||||
|
||||
private static function newObj() {
|
||||
if (!isset(self::$_connections)) {
|
||||
self::$_connections = new Connections();
|
||||
}
|
||||
return self::$_connections;
|
||||
}
|
||||
|
||||
public static function getInstance() {
|
||||
if (!isset(self::$_connections)) {
|
||||
return self::newObj();
|
||||
}
|
||||
return self::$_connections;
|
||||
}
|
||||
|
||||
public static function add_connection($pdo, $name = 'default') {
|
||||
self::getInstance()->connections[$name] = $pdo;
|
||||
}
|
||||
|
||||
public static function get_connection($name = 'default') {
|
||||
return self::getInstance()->connections[$name];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user