dibi::getConnection PHP Method

getConnection() public static method

Retrieve active connection.
public static getConnection ( $name = NULL ) : Dibi\Connection
return Dibi\Connection
    public static function getConnection($name = NULL)
    {
        if ($name === NULL) {
            if (self::$connection === NULL) {
                throw new Dibi\Exception('Dibi is not connected to database.');
            }
            return self::$connection;
        }
        if (!isset(self::$registry[$name])) {
            throw new Dibi\Exception("There is no connection named '{$name}'.");
        }
        return self::$registry[$name];
    }

Usage Example

Example #1
0
 public function __construct(IComponentContainer $parent = NULL, $name = NULL)
 {
     parent::__construct($parent, $name);
     $this->db = dibi::getConnection();
     self::$count++;
     //		$this->setWebloaderPaths();
 }
All Usage Examples Of dibi::getConnection