fix missing static methods
Dieser Commit ist enthalten in:
Ursprung
d587fde2e8
Commit
e6e772a2ce
@ -8,6 +8,7 @@
|
||||
namespace D3\OxidSqlLogger;
|
||||
|
||||
use Doctrine\DBAL\Configuration;
|
||||
use Doctrine\DBAL\Logging\SQLLogger;
|
||||
|
||||
/**
|
||||
* Class OxidEsalesDatabase
|
||||
@ -15,6 +16,18 @@ use Doctrine\DBAL\Configuration;
|
||||
*/
|
||||
class OxidEsalesDatabase extends \OxidEsales\Eshop\Core\Database\Adapter\Doctrine\Database
|
||||
{
|
||||
/**
|
||||
* @param null $message
|
||||
*
|
||||
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
|
||||
* @deprecated use non static d3EnableLogger method or D3StartSQLLog function
|
||||
*/
|
||||
public static function enableLogger($message = null)
|
||||
{
|
||||
$database = oxNew(OxidEsalesDatabase::class);
|
||||
$database->d3EnableLogger($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
|
||||
*/
|
||||
@ -23,6 +36,7 @@ class OxidEsalesDatabase extends \OxidEsales\Eshop\Core\Database\Adapter\Doctrin
|
||||
$trace = debug_backtrace((PHP_VERSION_ID < 50306) ? 2 : DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
|
||||
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
|
||||
/** @var Configuration $dbalConfig */
|
||||
$dbalConfig = $database->getConnection()->getConfiguration();
|
||||
$dbalConfig->setSQLLogger(
|
||||
new OxidSQLLogger(
|
||||
@ -36,22 +50,45 @@ class OxidEsalesDatabase extends \OxidEsales\Eshop\Core\Database\Adapter\Doctrin
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @return SQLLogger|null
|
||||
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
|
||||
* @deprecated use non static d3GetLogger method
|
||||
*/
|
||||
public static function getLogger()
|
||||
{
|
||||
$database = oxNew(OxidEsalesDatabase::class);
|
||||
return $database->d3GetLogger();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SQLLogger|null
|
||||
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
|
||||
*/
|
||||
public function d3GetLogger()
|
||||
{
|
||||
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
|
||||
/** @var Configuration $dbalConfig */
|
||||
$dbalConfig = $database->getConnection()->getConfiguration();
|
||||
return $dbalConfig->getSQLLogger();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
|
||||
* @deprecated use non static d3DisableLogger method or D3StopSQLLog function
|
||||
*/
|
||||
public static function disableLogger()
|
||||
{
|
||||
$database = oxNew(OxidEsalesDatabase::class);
|
||||
$database->d3DisableLogger();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
|
||||
*/
|
||||
public function d3DisableLogger()
|
||||
{
|
||||
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
|
||||
/** @var Configuration $dbalConfig */
|
||||
$dbalConfig = $database->getConnection()->getConfiguration();
|
||||
$dbalConfig->setSQLLogger(null);
|
||||
}
|
||||
|
@ -17,3 +17,11 @@ function D3StopSQLLog()
|
||||
$database = oxNew(\D3\OxidSqlLogger\OxidEsalesDatabase::class);
|
||||
$database->d3DisableLogger();
|
||||
}
|
||||
|
||||
function D3AddSQLLogItem($message)
|
||||
{
|
||||
/** @var \D3\OxidSqlLogger\OxidEsalesDatabase $database */
|
||||
$database = oxNew(\D3\OxidSqlLogger\OxidEsalesDatabase::class);
|
||||
$database->d3GetLogger()->startQuery($message);
|
||||
$database->d3GetLogger()->stopQuery($message);
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren