mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
Db/Connection: Replace getConnection() with getDpAdapter()
For readability getConnection() is deprecated in favor of getDpAdapter() since Db/Connection is already the connection.
This commit is contained in:
parent
c85ade39c0
commit
1a2577dd47
@ -54,8 +54,16 @@ class Connection implements DatasourceInterface
|
|||||||
*/
|
*/
|
||||||
private $dbType;
|
private $dbType;
|
||||||
|
|
||||||
private $conn;
|
/**
|
||||||
|
* @var Zend_Db_Adapter_Abstract
|
||||||
|
*/
|
||||||
|
private $dbAdapter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Table prefix
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
private $tablePrefix = '';
|
private $tablePrefix = '';
|
||||||
|
|
||||||
private static $genericAdapterOptions = array(
|
private static $genericAdapterOptions = array(
|
||||||
@ -81,7 +89,7 @@ class Connection implements DatasourceInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare query object
|
* Provide a query on this connection
|
||||||
*
|
*
|
||||||
* @return Query
|
* @return Query
|
||||||
*/
|
*/
|
||||||
@ -101,13 +109,13 @@ class Connection implements DatasourceInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for database object
|
* Getter for the Zend_Db_Adapter
|
||||||
*
|
*
|
||||||
* @return Zend_Db_Adapter_Abstract
|
* @return Zend_Db_Adapter_Abstract
|
||||||
*/
|
*/
|
||||||
public function getDb()
|
public function getDbAdapter()
|
||||||
{
|
{
|
||||||
return $this->db;
|
return $this->dbAdapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -157,21 +165,37 @@ class Connection implements DatasourceInterface
|
|||||||
default:
|
default:
|
||||||
throw new ConfigurationError(sprintf('Backend "%s" is not supported', $this->dbType));
|
throw new ConfigurationError(sprintf('Backend "%s" is not supported', $this->dbType));
|
||||||
}
|
}
|
||||||
$this->conn = Zend_Db::factory($adapter, $adapterParamaters);
|
$this->dbAdapter = Zend_Db::factory($adapter, $adapterParamaters);
|
||||||
$this->conn->setFetchMode(Zend_Db::FETCH_OBJ);
|
$this->dbAdapter->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||||
$this->conn->getProfiler()->setEnabled(false);
|
// TODO(el/tg): The profiler is disabled per default, why do we disable the profiler explicitly?
|
||||||
|
$this->dbAdapter->getProfiler()->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use Connection::getDbAdapter() instead
|
||||||
|
*/
|
||||||
public function getConnection()
|
public function getConnection()
|
||||||
{
|
{
|
||||||
return $this->conn;
|
return $this->dbAdapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter for the table prefix
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function getTablePrefix()
|
public function getTablePrefix()
|
||||||
{
|
{
|
||||||
return $this->tablePrefix;
|
return $this->tablePrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter for the table prefix
|
||||||
|
*
|
||||||
|
* @param string $prefix
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
public function setTablePrefix($prefix)
|
public function setTablePrefix($prefix)
|
||||||
{
|
{
|
||||||
$this->tablePrefix = $prefix;
|
$this->tablePrefix = $prefix;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user