-
-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Corrected event to attach Doctrine SQL Logger to ZendDeveloperTools
- Loading branch information
1 parent
2205a3c
commit d0ff7aa
Showing
1 changed file
with
13 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,12 @@ | |
|
||
use Interop\Container\ContainerInterface; | ||
use Zend\EventManager\EventInterface; | ||
use Zend\ModuleManager\Feature\BootstrapListenerInterface; | ||
use Zend\ModuleManager\Feature\ControllerProviderInterface; | ||
use Zend\ModuleManager\Feature\ConfigProviderInterface; | ||
use Zend\ModuleManager\Feature\DependencyIndicatorInterface; | ||
use Zend\ModuleManager\ModuleManagerInterface; | ||
use DoctrineORMModule\CliConfigurator; | ||
use ZendDeveloperTools\ProfilerEvent; | ||
|
||
/** | ||
* Base module for Doctrine ORM. | ||
|
@@ -20,7 +20,6 @@ | |
* @author Marco Pivetta <[email protected]> | ||
*/ | ||
class Module implements | ||
BootstrapListenerInterface, | ||
ControllerProviderInterface, | ||
ConfigProviderInterface, | ||
DependencyIndicatorInterface | ||
|
@@ -46,28 +45,19 @@ function (EventInterface $event) { | |
}, | ||
1 | ||
); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function onBootstrap(EventInterface $event) | ||
{ | ||
/* @var $application \Zend\Mvc\Application */ | ||
$application = $event->getTarget(); | ||
|
||
/* @var $container ContainerInterface */ | ||
$container = $application->getServiceManager(); | ||
|
||
$events = $application->getEventManager(); | ||
|
||
// Initialize logger collector once the profiler is initialized itself | ||
$events->attach( | ||
'profiler_init', | ||
function () use ($container) { | ||
$container->get('doctrine.sql_logger_collector.orm_default'); | ||
} | ||
); | ||
// Initialize logger collector in ZendDeveloperTools | ||
if (class_exists(ProfilerEvent::class)) { | ||
$manager | ||
->getEventManager() | ||
->attach( | ||
ProfilerEvent::EVENT_PROFILER_INIT, | ||
function ($event) { | ||
$container = $event->getTarget()->getParam('ServiceManager'); | ||
$container->get('doctrine.sql_logger_collector.orm_default'); | ||
} | ||
); | ||
} | ||
} | ||
|
||
/** | ||
|