terwey / doctrine-stack-bundle
Symfony DoctrineBundle extension with a Stacktrace per Query
Installs: 68
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.2
- doctrine/doctrine-bundle: ~1.1
- symfony/web-profiler-bundle: *
This package is not auto-updated.
Last update: 2024-12-21 17:22:30 UTC
README
Symfony DoctrineBundle extension with a Stacktrace per Query
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
Change this line:
$this->queries[++$this->currentQuery] = array('sql' => $sql, 'params' => $params, 'types' => $types, 'executionMS' => 0);
To this line:
$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!