4
4
5
5
use Interop \Container \ContainerInterface ;
6
6
use Zend \EventManager \EventInterface ;
7
- use Zend \ModuleManager \Feature \BootstrapListenerInterface ;
8
7
use Zend \ModuleManager \Feature \ControllerProviderInterface ;
9
8
use Zend \ModuleManager \Feature \ConfigProviderInterface ;
10
9
use Zend \ModuleManager \Feature \DependencyIndicatorInterface ;
11
10
use Zend \ModuleManager \ModuleManagerInterface ;
12
11
use DoctrineORMModule \CliConfigurator ;
12
+ use ZendDeveloperTools \ProfilerEvent ;
13
13
14
14
/**
15
15
* Base module for Doctrine ORM.
20
20
* @author Marco Pivetta <ocramius@gmail.com>
21
21
*/
22
22
class Module implements
23
- BootstrapListenerInterface,
24
23
ControllerProviderInterface,
25
24
ConfigProviderInterface,
26
25
DependencyIndicatorInterface
@@ -46,28 +45,19 @@ function (EventInterface $event) {
46
45
},
47
46
1
48
47
);
49
- }
50
-
51
- /**
52
- * {@inheritDoc}
53
- */
54
- public function onBootstrap (EventInterface $ event )
55
- {
56
- /* @var $application \Zend\Mvc\Application */
57
- $ application = $ event ->getTarget ();
58
-
59
- /* @var $container ContainerInterface */
60
- $ container = $ application ->getServiceManager ();
61
-
62
- $ events = $ application ->getEventManager ();
63
48
64
- // Initialize logger collector once the profiler is initialized itself
65
- $ events ->attach (
66
- 'profiler_init ' ,
67
- function () use ($ container ) {
68
- $ container ->get ('doctrine.sql_logger_collector.orm_default ' );
69
- }
70
- );
49
+ // Initialize logger collector in ZendDeveloperTools
50
+ if (class_exists (ProfilerEvent::class)) {
51
+ $ manager
52
+ ->getEventManager ()
53
+ ->attach (
54
+ ProfilerEvent::EVENT_PROFILER_INIT ,
55
+ function ($ event ) {
56
+ $ container = $ event ->getTarget ()->getParam ('ServiceManager ' );
57
+ $ container ->get ('doctrine.sql_logger_collector.orm_default ' );
58
+ }
59
+ );
60
+ }
71
61
}
72
62
73
63
/**
0 commit comments