mirror of
https://github.com/yiisoft/yii2.git
synced 2025-12-01 06:59:29 +08:00
Mongo connection advanced.
This commit is contained in:
@@ -15,6 +15,8 @@ use Yii;
|
||||
/**
|
||||
* Class Connection
|
||||
*
|
||||
* @property boolean $isActive Whether the Mongo connection is established. This property is read-only.
|
||||
*
|
||||
* @author Paul Klimov <klimov.paul@gmail.com>
|
||||
* @since 2.0
|
||||
*/
|
||||
@@ -49,6 +51,15 @@ class Connection extends Component
|
||||
*/
|
||||
public $dbName;
|
||||
|
||||
/**
|
||||
* Returns a value indicating whether the Mongo connection is established.
|
||||
* @return boolean whether the Mongo connection is established
|
||||
*/
|
||||
public function getIsActive()
|
||||
{
|
||||
return is_object($this->client) && $this->client->connected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Establishes a Mongo connection.
|
||||
* It does nothing if a Mongo connection has already been established.
|
||||
|
||||
Reference in New Issue
Block a user