本文整理汇总了PHP中ConnectionManager::get_connection方法的典型用法代码示例。如果您正苦于以下问题:PHP ConnectionManager::get_connection方法的具体用法?PHP ConnectionManager::get_connection怎么用?PHP ConnectionManager::get_connection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionManager
的用法示例。
在下文中一共展示了ConnectionManager::get_connection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($class_name)
{
$this->class = Reflections::instance()->add($class_name)->get($class_name);
// if connection name property is null the connection manager will use the default connection
$connection = $this->class->getStaticPropertyValue('connection', null);
$this->conn = ConnectionManager::get_connection($connection);
$this->set_table_name();
$this->get_meta_data();
$this->set_primary_key();
$this->set_sequence_name();
$this->set_delegates();
$this->set_setters_and_getters();
$this->callback = new CallBack($class_name);
$this->callback->register('before_save', function (Model $model) {
$model->set_timestamps();
}, array('prepend' => true));
$this->callback->register('after_save', function (Model $model) {
$model->reset_dirty();
}, array('prepend' => true));
}
示例2: reestablish_connection
public function reestablish_connection($close = true)
{
// if connection name property is null the connection manager will use the default connection
$connection = $this->class->getStaticPropertyValue('connection', null);
if ($close) {
ConnectionManager::drop_connection($connection);
static::clear_cache();
}
return $this->conn = ConnectionManager::get_connection($connection);
}