pbowyer/sql-cache-tagger

Investigate using my own Connection class

Opened this issue · 0 comments

https://stackoverflow.com/a/64359544/119750

Doctrine DBAL allows you to define your own Connection class.

doctrine:
    dbal:
        wrapper_class: App\DBAL\MyConnectionWrapper

You could implement a child class of Doctrine\DBAL\Connection and override executeQuery() according to your needs.

class MyConnectionWrapper extends Connection
{
  public function executeQuery($sql, array $params = [], $types = [], ?QueryCacheProfile $qcp = null)
  {
    $sql = '/*PAGE NAME*/ '.$sql;
    return parent::executeQuery($sql, $params, $types, $qcp);
  }
}