|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace DoctrineORMModule; |
|
4
|
|
|
|
|
5
|
|
|
use Interop\Container\ContainerInterface; |
|
6
|
|
|
use Zend\EventManager\EventInterface; |
|
7
|
|
|
use Zend\ModuleManager\Feature\BootstrapListenerInterface; |
|
8
|
|
|
use Zend\ModuleManager\Feature\ControllerProviderInterface; |
|
9
|
|
|
use Zend\ModuleManager\Feature\ConfigProviderInterface; |
|
10
|
|
|
use Zend\ModuleManager\Feature\DependencyIndicatorInterface; |
|
11
|
|
|
use Zend\ModuleManager\ModuleManagerInterface; |
|
12
|
|
|
use DoctrineORMModule\CliConfigurator; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Base module for Doctrine ORM. |
|
16
|
|
|
* |
|
17
|
|
|
* @license MIT |
|
18
|
|
|
* @link www.doctrine-project.org |
|
19
|
|
|
* @author Kyle Spraggs <[email protected]> |
|
20
|
|
|
* @author Marco Pivetta <[email protected]> |
|
21
|
|
|
*/ |
|
22
|
|
|
class Module implements |
|
23
|
|
|
BootstrapListenerInterface, |
|
24
|
|
|
ControllerProviderInterface, |
|
25
|
|
|
ConfigProviderInterface, |
|
26
|
|
|
DependencyIndicatorInterface |
|
27
|
|
|
{ |
|
28
|
|
|
/** |
|
29
|
|
|
* {@inheritDoc} |
|
30
|
|
|
*/ |
|
31
|
|
|
public function init(ModuleManagerInterface $manager) |
|
32
|
|
|
{ |
|
33
|
|
|
$events = $manager->getEventManager(); |
|
34
|
|
|
$serviceManager = $manager->getEvent()->getParam('ServiceManager'); |
|
|
|
|
|
|
35
|
|
|
|
|
36
|
|
|
$events->getSharedManager()->attach('doctrine', 'loadCli.post', [$this, 'initializeConsole'], 1); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Initialize the Doctrine console |
|
41
|
|
|
* |
|
42
|
|
|
* @param EventInterface |
|
43
|
|
|
*/ |
|
44
|
|
|
public function initializeConsole(EventInterface $event) |
|
45
|
|
|
{ |
|
46
|
|
|
$container = $event->getParam('ServiceManager'); |
|
47
|
|
|
$cliConfigurator = $container->get(CliConfigurator::class); |
|
48
|
|
|
$cliConfigurator->configure($event->getTarget()); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* {@inheritDoc} |
|
53
|
|
|
*/ |
|
54
|
|
|
public function onBootstrap(EventInterface $event) |
|
55
|
72 |
|
{ |
|
56
|
|
|
/* @var $application \Zend\Mvc\Application */ |
|
57
|
72 |
|
$application = $event->getTarget(); |
|
58
|
|
|
|
|
59
|
|
|
/* @var $container ContainerInterface */ |
|
60
|
|
|
$container = $application->getServiceManager(); |
|
61
|
|
|
|
|
62
|
|
|
$events = $application->getEventManager(); |
|
63
|
72 |
|
|
|
64
|
|
|
// Initialize logger collector once the profiler is initialized itself |
|
65
|
72 |
|
$events->attach( |
|
66
|
|
|
'profiler_init', |
|
67
|
|
|
function () use ($container) { |
|
68
|
|
|
$container->get('doctrine.sql_logger_collector.orm_default'); |
|
69
|
|
|
} |
|
70
|
|
|
); |
|
71
|
72 |
|
} |
|
72
|
|
|
|
|
73
|
72 |
|
/** |
|
74
|
|
|
* {@inheritDoc} |
|
75
|
|
|
*/ |
|
76
|
|
|
public function getConfig() |
|
77
|
|
|
{ |
|
78
|
|
|
return include __DIR__ . '/../../config/module.config.php'; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* {@inheritDoc} |
|
83
|
|
|
*/ |
|
84
|
|
|
public function getControllerConfig() |
|
85
|
|
|
{ |
|
86
|
|
|
return include __DIR__ . '/../../config/controllers.config.php'; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* {@inheritDoc} |
|
91
|
|
|
*/ |
|
92
|
|
|
public function getModuleDependencies() |
|
93
|
|
|
{ |
|
94
|
|
|
return ['DoctrineModule']; |
|
95
|
|
|
} |
|
96
|
|
|
} |
|
97
|
|
|
|
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.