コード例 #1
0
ファイル: Implementation.php プロジェクト: jasny/db-rest
 /**
  * Get the database connection
  * 
  * @return Client
  */
 protected static function getDB()
 {
     $db = \Jasny\DB::conn();
     if (!$db instanceof Client) {
         throw new Exception("Default connection isn't a REST client");
     }
     return $db;
 }
コード例 #2
0
ファイル: MetaImplementation.php プロジェクト: jasny/db-rest
 /**
  * Get the database connection
  * 
  * @return \Jasny\DB
  */
 protected static function getDB()
 {
     $name = static::meta()['db'] ?: 'default';
     $db = \Jasny\DB::conn($name);
     if (!$db instanceof Jasny\DB\REST\Client) {
         throw new Exception("Selected database connection {$name} is not a REST client");
     }
     return $db;
 }
コード例 #3
0
ファイル: MetaImplementation.php プロジェクト: jasny/db-mongo
 /**
  * Get the database connection
  * 
  * @return \Jasny\DB
  */
 protected static function getDB()
 {
     $name = static::meta()['db'] ?: 'default';
     return \Jasny\DB::conn($name);
 }
コード例 #4
0
ファイル: Implementation.php プロジェクト: jasny/db-mongo
 /**
  * Get the database connection
  * 
  * @return \Jasny\DB
  */
 protected static function getDB()
 {
     return \Jasny\DB::conn();
 }