|
static | getInstance () |
|
static | getDb ($fetchMode=\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_NUM) |
|
static | getMaster ($fetchMode=\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_NUM) |
|
Database connection class
◆ __construct()
OxidEsales\EshopCommunity\Core\DatabaseProvider::__construct |
( |
| ) |
|
◆ __clone()
OxidEsales\EshopCommunity\Core\DatabaseProvider::__clone |
( |
| ) |
|
As this class is a singleton, an instance of this class must not be cloned.
- Exceptions
-
◆ createDatabase()
OxidEsales\EshopCommunity\Core\DatabaseProvider::createDatabase |
( |
| ) |
|
|
protected |
Creates database connection and returns it.
- Exceptions
-
DatabaseConnectionException | |
DatabaseNotConfiguredException | |
- Returns
- DatabaseInterface
◆ fetchConfigFile()
OxidEsales\EshopCommunity\Core\DatabaseProvider::fetchConfigFile |
( |
| ) |
|
|
protected |
Get an instance of the config file.
- Exceptions
-
DatabaseNotConfiguredException | |
- Returns
- ConfigFile
◆ fetchTableDescription()
OxidEsales\EshopCommunity\Core\DatabaseProvider::fetchTableDescription |
( |
|
$tableName | ) |
|
|
protected |
Extracts and returns table metadata from DB. This method is extended in the Enterprise Edition.
- Parameters
-
- Returns
- array
◆ flushTableDescriptionCache()
OxidEsales\EshopCommunity\Core\DatabaseProvider::flushTableDescriptionCache |
( |
| ) |
|
Flush the table description cache of this class.
◆ getConfigParam()
OxidEsales\EshopCommunity\Core\DatabaseProvider::getConfigParam |
( |
|
$configVar | ) |
|
|
protected |
Return local config value by given name.
- Parameters
-
string | $configVar | returning config name. |
- Returns
- mixed
◆ getConnectionParameters()
OxidEsales\EshopCommunity\Core\DatabaseProvider::getConnectionParameters |
( |
| ) |
|
|
protected |
Get all parameters needed to connect to the database.
- Returns
- array
◆ getDb()
static OxidEsales\EshopCommunity\Core\DatabaseProvider::getDb |
( |
|
$fetchMode = \OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_NUM | ) |
|
|
static |
Return the database connection instance as a singleton.
- Parameters
-
int | $fetchMode | The fetch mode. Default is numeric (0). |
- Exceptions
-
DatabaseConnectionException | Error while initiating connection to DB. |
- Returns
- DatabaseInterface
◆ getInstance()
static OxidEsales\EshopCommunity\Core\DatabaseProvider::getInstance |
( |
| ) |
|
|
static |
Returns the singleton instance of this class or of a sub class of this class.
- Returns
- DatabaseProvider The singleton instance.
◆ getMaster()
static OxidEsales\EshopCommunity\Core\DatabaseProvider::getMaster |
( |
|
$fetchMode = \OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_NUM | ) |
|
|
static |
Return the database master connection instance as a singleton. In case the shop is not allowed a master/slave setup, this function is simply a wrapper for DatabaseProvider::getDb.
- Parameters
-
int | $fetchMode | The fetch mode. Default is numeric (0). |
- Exceptions
-
DatabaseConnectionException | Error while initiating connection to DB |
- Returns
- DatabaseInterface
◆ getTableDescription()
OxidEsales\EshopCommunity\Core\DatabaseProvider::getTableDescription |
( |
|
$tableName | ) |
|
Extracts and returns table metadata from DB.
- Parameters
-
string | $tableName | Name of table to invest. |
- Returns
- array
◆ isAdmin()
OxidEsales\EshopCommunity\Core\DatabaseProvider::isAdmin |
( |
| ) |
|
|
protected |
Call function is admin from oxFunction. Need to mock in tests.
- Returns
- bool
◆ isDatabaseConfigured()
OxidEsales\EshopCommunity\Core\DatabaseProvider::isDatabaseConfigured |
( |
\OxidEsales\Eshop\Core\ConfigFile |
$config | ) |
|
|
protected |
Return false if the database connection has not been configured in the eShop configuration file.
- Parameters
-
- Returns
- bool
◆ onPostConnect()
OxidEsales\EshopCommunity\Core\DatabaseProvider::onPostConnect |
( |
| ) |
|
|
protected |
Post connect hook. This method is called only once per connection right after the connection to the database has been established.
◆ setConfigFile()
OxidEsales\EshopCommunity\Core\DatabaseProvider::setConfigFile |
( |
\OxidEsales\Eshop\Core\ConfigFile |
$configFile | ) |
|
Sets class properties needed for a successful database connection
- Parameters
-
ConfigFile | $configFile | The file config.inc.php wrapped in an object |
◆ validateConfigFile()
OxidEsales\EshopCommunity\Core\DatabaseProvider::validateConfigFile |
( |
\OxidEsales\Eshop\Core\ConfigFile |
$configFile | ) |
|
|
protected |
Validate configuration file. The parameters are validated and on failure the method behaves like this:
- if the shop is has not been configured yet, throws a DatabaseNotConfiguredException
- Parameters
-
- Exceptions
-
DatabaseNotConfiguredException | |
◆ $configFile
OxidEsales\EshopCommunity\Core\DatabaseProvider::$configFile |
|
protected |
◆ $db
OxidEsales\EshopCommunity\Core\DatabaseProvider::$db = null |
|
staticprotected |
◆ $instance
OxidEsales\EshopCommunity\Core\DatabaseProvider::$instance = null |
|
staticprotected |
◆ $tblDescCache
OxidEsales\EshopCommunity\Core\DatabaseProvider::$tblDescCache = [] |
|
staticprotected |
◆ FETCH_MODE_ASSOC
const OxidEsales\EshopCommunity\Core\DatabaseProvider::FETCH_MODE_ASSOC = DatabaseInterface::FETCH_MODE_ASSOC |
◆ FETCH_MODE_NUM
const OxidEsales\EshopCommunity\Core\DatabaseProvider::FETCH_MODE_NUM = DatabaseInterface::FETCH_MODE_NUM |
The documentation for this class was generated from the following file: