本文整理汇总了PHP中static::_connection方法的典型用法代码示例。如果您正苦于以下问题:PHP static::_connection方法的具体用法?PHP static::_connection怎么用?PHP static::_connection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::_connection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MockDocumentSource
public static function &connection()
{
if (!static::$_connection) {
static::$_connection = new MockDocumentSource();
}
return static::$_connection;
}
示例2: _init
public static function _init()
{
\Config::load('debtsolv', 'debtsolv');
static::$_debtsolv_database = \Config::get('debtsolv.debtsolv_database', static::$_debtsolv_database);
static::$_leadpool_database = \Config::get('debtsolv.leadpool_database', static::$_leadpool_database);
static::$_connection = \Database_Connection::instance('Debtsolv', \Config::get('debtsolv.connection', static::$_connection));
}
示例3: connection
/**
* Named connection getter/setter
*/
public static function connection($connection = null)
{
if (null !== $connection) {
static::$_connection = $connection;
return $this;
}
return static::$_connection;
}
示例4: _init
/**
* init the class
*/
public static function _init()
{
// auth config
\Config::load('ormauth', true);
// set the connection this model should use
static::$_connection = \Config::get('ormauth.db_connection');
// set the models table name
static::$_table_name = \Config::get('ormauth.table_name', 'users') . '_user_permissions';
}
示例5: _init
/**
* init the class
*/
public static function _init()
{
// auth config
\Config::load('ormauth', true);
// set the connection this model should use
static::$_connection = \Config::get('ormauth.db_connection');
// set the write connection this model should use
static::$_write_connection = \Config::get('ormauth.db_write_connection') ?: static::$_connection;
// set the models table name
static::$_table_name = \Config::get('ormauth.table_name', 'users') . '_providers';
}
示例6: forge
public static function forge($companyID = 0, $clientID = 0)
{
// -- Set the database name
// ------------------------
$Database = Database::connect((int) $companyID);
static::$databaseName = $Database->debtsolvDBName();
static::$_connection = $Database->connection();
// -- Set the Client ID
// --------------------
static::$clientID = (int) $clientID;
static::$_companyID = (int) $companyID;
}
示例7: _init
/**
* init the class
*/
public static function _init()
{
// auth config
\Config::load('ormauth', true);
// set the connection this model should use
static::$_connection = \Config::get('ormauth.db_connection');
// set the models table name
static::$_table_name = \Config::get('ormauth.table_name', 'users') . '_groups';
// set the relations through table names
static::$_many_many['roles']['table_through'] = \Config::get('ormauth.table_name', 'users') . '_group_roles';
static::$_many_many['permissions']['table_through'] = \Config::get('ormauth.table_name', 'users') . '_group_permissions';
// model language file
\Lang::load('auth_model_group', true);
}
示例8: connect
public function connect()
{
try {
static::$_oauth = new OAuth(static::$_defaults['consumer_key'], static::$_defaults['consumer_secret'], OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
static::$_oauth->enableDebug();
static::$_oauth->enableSSLChecks();
static::$_oauth->setToken(static::$_defaults['token'], static::$_defaults['token_secret']);
//make a simple request to trythe connection
static::$_oauth->fetch(static::$_defaults['info_info_api_url']);
static::$_connection = true;
} catch (OAuthException $E) {
static::setErrot($E->lastResponse, $E->getCode());
static::$_connection = false;
}
return static::$_connection;
}
示例9: connection
/**
* Fetch the database connection name to use
*
* @param bool if true return the writeable connection (if set)
* @return null|string
*/
public static function connection($writeable = false)
{
// if in tracsaction, conection force to be writable.
if (\DB::in_transaction()) {
$writeable = true;
}
if ($writeable) {
if (empty(static::$_write_connection)) {
static::$_write_connection = static::get_write_connection_default();
}
return static::$_write_connection;
}
if (empty(static::$_connection)) {
static::$_connection = static::get_read_connection_default();
}
return static::$_connection;
}
示例10: _init
/**
* Static constructor called by autoloader
*/
public static function _init()
{
$config = \Config::load('tinychimp');
if (empty($config['api_key'])) {
throw new \FuelException('API key not specified.');
}
static::$api_key = $config['api_key'];
static::$secure_connection = is_bool($config['secure']) ? $config['secure'] : false;
static::$timeout = is_integer($config['timeout']) ? $config['timeout'] : 300;
static::$api_url = empty($config['api_url']) ? static::get_api_url() : $config['api_url'];
$connection = curl_init();
curl_setopt_array($connection, array(CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => static::$timeout, CURLOPT_POST => true));
if (static::$secure_connection) {
curl_setopt_array($connection, array(CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => true, CURLOPT_PORT => 443));
}
static::$_connection = $connection;
}
示例11: _init
/**
* init the class
*/
public static function _init()
{
// auth config
\Config::load('ormauth', true);
// set the connection this model should use
static::$_connection = \Config::get('ormauth.db_connection');
// set the write connection this model should use
static::$_connection = \Config::get('ormauth.db_write_connection');
// set the models table name
static::$_table_name = \Config::get('ormauth.table_name', 'users') . '_roles';
// set the relations through table names
static::$_many_many['users']['table_through'] = \Config::get('ormauth.table_name', 'users') . '_user_roles';
static::$_many_many['groups']['table_through'] = \Config::get('ormauth.table_name', 'users') . '_group_roles';
static::$_many_many['permissions']['table_through'] = \Config::get('ormauth.table_name', 'users') . '_role_permissions';
// model language file
\Lang::load('auth_model_role', true);
// set the filter options from the language file
static::$_properties['filter']['form']['options'] = \Lang::get('auth_model_role.permissions');
}
示例12: setDatabaseConnection
/**
* Get the database name
*
* @author David stansfield
*/
public static function setDatabaseConnection()
{
$Database = Database::connect(static::$_userCentreID);
static::$_connection = $Database->connection();
static::$_debtsolvDatabase = $Database->debtsolvDBName();
}
示例13: setConnectionString
/**
* @param string $connectionString
* @param string $userName
* @param string $password
* @param array $pdoOptions
*
* @return void|\PDO
*/
public static function setConnectionString($connectionString, $userName = null, $password = null, array $pdoOptions = [])
{
static::setConnection(null);
// If you set a connection string a new connection one is created for you
if (!empty($connectionString)) {
static::$_connectionString = $connectionString;
static::$_connection = new \PDO(static::$_connectionString, $userName, $password, array_merge([\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION], $pdoOptions));
}
return static::$_connection;
}
示例14: set_connection
/**
* Sets the write connection to use for this model.
* @param string $connection
*/
public static function set_connection($connection)
{
static::$_connection = $connection;
}
示例15: connection
/**
* Gets/sets the connection object to which this model is bound.
*
* @param object $connection The connection instance to set or `null` to get the current one.
* @return mixed Returns a connection instance on get.
*/
public static function connection($connection = null)
{
if (func_num_args()) {
static::$_connection = $connection;
unset(static::$_definitions[static::class]);
return;
}
return static::$_connection;
}