Mongo connection advanced.

This commit is contained in:
Paul Klimov
2013-11-25 14:34:22 +02:00
parent ae0f04be99
commit c61ebcc5b7
2 changed files with 36 additions and 2 deletions

View File

@@ -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.