fix missing static methods
This commit is contained in:
parent
d587fde2e8
commit
e6e772a2ce
@ -8,6 +8,7 @@
|
|||||||
namespace D3\OxidSqlLogger;
|
namespace D3\OxidSqlLogger;
|
||||||
|
|
||||||
use Doctrine\DBAL\Configuration;
|
use Doctrine\DBAL\Configuration;
|
||||||
|
use Doctrine\DBAL\Logging\SQLLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class OxidEsalesDatabase
|
* Class OxidEsalesDatabase
|
||||||
@ -15,6 +16,18 @@ use Doctrine\DBAL\Configuration;
|
|||||||
*/
|
*/
|
||||||
class OxidEsalesDatabase extends \OxidEsales\Eshop\Core\Database\Adapter\Doctrine\Database
|
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
|
* @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);
|
$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);
|
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
|
||||||
|
/** @var Configuration $dbalConfig */
|
||||||
$dbalConfig = $database->getConnection()->getConfiguration();
|
$dbalConfig = $database->getConnection()->getConfiguration();
|
||||||
$dbalConfig->setSQLLogger(
|
$dbalConfig->setSQLLogger(
|
||||||
new OxidSQLLogger(
|
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
|
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
|
||||||
*/
|
*/
|
||||||
public function d3GetLogger()
|
public function d3GetLogger()
|
||||||
{
|
{
|
||||||
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
|
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
|
||||||
|
/** @var Configuration $dbalConfig */
|
||||||
$dbalConfig = $database->getConnection()->getConfiguration();
|
$dbalConfig = $database->getConnection()->getConfiguration();
|
||||||
return $dbalConfig->getSQLLogger();
|
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
|
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
|
||||||
*/
|
*/
|
||||||
public function d3DisableLogger()
|
public function d3DisableLogger()
|
||||||
{
|
{
|
||||||
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
|
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
|
||||||
|
/** @var Configuration $dbalConfig */
|
||||||
$dbalConfig = $database->getConnection()->getConfiguration();
|
$dbalConfig = $database->getConnection()->getConfiguration();
|
||||||
$dbalConfig->setSQLLogger(null);
|
$dbalConfig->setSQLLogger(null);
|
||||||
}
|
}
|
||||||
|
@ -17,3 +17,11 @@ function D3StopSQLLog()
|
|||||||
$database = oxNew(\D3\OxidSqlLogger\OxidEsalesDatabase::class);
|
$database = oxNew(\D3\OxidSqlLogger\OxidEsalesDatabase::class);
|
||||||
$database->d3DisableLogger();
|
$database->d3DisableLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function D3AddSQLLogItem($message)
|
||||||
|
{
|
||||||
|
/** @var \D3\OxidSqlLogger\OxidEsalesDatabase $database */
|
||||||
|
$database = oxNew(\D3\OxidSqlLogger\OxidEsalesDatabase::class);
|
||||||
|
$database->d3GetLogger()->startQuery($message);
|
||||||
|
$database->d3GetLogger()->stopQuery($message);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user