30 lines
727 B
PHP
30 lines
727 B
PHP
<?php
|
|
|
|
namespace KupShop\KupShopBundle\Wrapper\Database;
|
|
|
|
use Doctrine\DBAL\Cache\QueryCacheProfile;
|
|
use Doctrine\DBAL\Connection;
|
|
use KupShop\KupShopBundle\Util\Database\QueryHint;
|
|
|
|
class ConnectionWrapper extends Connection
|
|
{
|
|
public function query()
|
|
{
|
|
$args = func_get_args();
|
|
|
|
$args[0] = QueryHint::hint($args[0]);
|
|
|
|
return parent::query(...$args);
|
|
}
|
|
|
|
public function executeQuery($sql, array $params = [], $types = [], ?QueryCacheProfile $qcp = null)
|
|
{
|
|
return parent::executeQuery(QueryHint::hint($sql), $params, $types, $qcp);
|
|
}
|
|
|
|
public function lastInsertId($name = null)
|
|
{
|
|
return $this->executeQuery('SELECT LAST_INSERT_ID();')->fetchOne();
|
|
}
|
|
}
|