Thursday, 22 August 2013

Yii get database connection

Yii get database connection

Is there an advantage in the use:
public function getConnection()
{
if (!isset($this->_connection)) {
$this->_connection = Yii::app()->db;
}
return $this->_connection;
}
instead of:
public function getConnection()
{
return Yii::app()->db;
}
and why?

No comments:

Post a Comment