2017 © Pedro Peláez
 

symfony-bundle doctrine-stack-bundle

Symfony DoctrineBundle extension with a Stacktrace per Query

image

terwey/doctrine-stack-bundle

Symfony DoctrineBundle extension with a Stacktrace per Query

  • Tuesday, May 27, 2014
  • by terwey
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 18 % Grown

The README.md

DoctrineStackBundle

Symfony DoctrineBundle extension with a Stacktrace per Query, (*1)

Require in composer.json

"terwey/doctrine-stack-bundle": "dev-master"

Register with your AppKernel

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Terwey\DoctrineStackBundle\DoctrineStackBundle();
}

WARNING

I currently can't figure out how to get it to properly work from a Bundle so you'll have to replace this file locally: vendor/doctrine/dbal/lib/Doctrine/DBAL/Logging/DebugStack.php, (*2)

Change this line:, (*3)

$this->queries[++$this->currentQuery] = array('sql' => $sql, 'params' => $params, 'types' => $types, 'executionMS' => 0);

To this line:, (*4)

$e = new \Exception;
$shortTrace = explode("\n", $e->getTraceAsString())[5];
$this->queries[++$this->currentQuery] = array('sql' => $sql, 'params' => $params, 'types' => $types, 'executionMS' => 0, 'stacktrace' => $e->getTraceAsString(), 'shortstack' => $shortTrace);

If you happen to know how to do this properly, please make a PR!, (*5)

The Versions

27/05 2014

dev-master

9999999-dev

Symfony DoctrineBundle extension with a Stacktrace per Query

  Sources   Download

MIT

The Requires