|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
4
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
5
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
6
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
7
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
8
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
9
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
10
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
11
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
12
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
13
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
14
|
|
|
* |
|
15
|
|
|
* This software consists of voluntary contributions made by many individuals |
|
16
|
|
|
* and is licensed under the MIT license. For more information, see |
|
17
|
|
|
* <http://www.doctrine-project.org>. |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
namespace DoctrineORMModule; |
|
21
|
|
|
|
|
22
|
|
|
use DoctrineORMModule\Listener\PostCliLoadListener; |
|
23
|
|
|
use Psr\Container\ContainerInterface; |
|
24
|
|
|
use Symfony\Component\Console\Application; |
|
25
|
|
|
use Zend\EventManager\EventInterface; |
|
26
|
|
|
use Zend\ModuleManager\Feature\BootstrapListenerInterface; |
|
27
|
|
|
use Zend\ModuleManager\Feature\ControllerProviderInterface; |
|
28
|
|
|
use Zend\ModuleManager\Feature\ConfigProviderInterface; |
|
29
|
|
|
use Zend\ModuleManager\Feature\InitProviderInterface; |
|
30
|
|
|
use Zend\ModuleManager\Feature\DependencyIndicatorInterface; |
|
31
|
|
|
use Zend\ModuleManager\ModuleManagerInterface; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Base module for Doctrine ORM. |
|
35
|
|
|
* |
|
36
|
|
|
* @license MIT |
|
37
|
|
|
* @link www.doctrine-project.org |
|
38
|
|
|
* @author Kyle Spraggs <[email protected]> |
|
39
|
|
|
* @author Marco Pivetta <[email protected]> |
|
40
|
|
|
*/ |
|
41
|
|
|
class Module implements |
|
42
|
|
|
ControllerProviderInterface, |
|
43
|
|
|
ConfigProviderInterface, |
|
44
|
|
|
InitProviderInterface, |
|
45
|
|
|
DependencyIndicatorInterface, |
|
46
|
|
|
BootstrapListenerInterface |
|
47
|
|
|
{ |
|
48
|
|
|
/** |
|
49
|
|
|
* {@inheritDoc} |
|
50
|
|
|
*/ |
|
51
|
|
|
public function init(ModuleManagerInterface $manager) |
|
52
|
|
|
{ |
|
53
|
72 |
|
$events = $manager->getEventManager(); |
|
54
|
|
|
$serviceManager = $manager->getEvent()->getParam('ServiceManager'); |
|
|
|
|
|
|
55
|
72 |
|
|
|
56
|
|
|
// Initialize logger collector once the profiler is initialized itself |
|
57
|
72 |
|
$events->attach( |
|
58
|
72 |
|
'profiler_init', |
|
59
|
|
|
function () use ($serviceManager) { |
|
60
|
|
|
$serviceManager->get('doctrine.sql_logger_collector.orm_default'); |
|
61
|
|
|
} |
|
62
|
72 |
|
); |
|
63
|
72 |
|
|
|
64
|
72 |
|
/* @var $postCliLoadListener PostCliLoadListener */ |
|
65
|
|
|
$postCliLoadListener = $serviceManager->get(PostCliLoadListener::class); |
|
66
|
|
|
$postCliLoadListener->attach($events); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
72 |
|
/** |
|
70
|
|
|
* {@inheritDoc} |
|
71
|
72 |
|
*/ |
|
72
|
|
|
public function getConfig() |
|
73
|
|
|
{ |
|
74
|
|
|
return include __DIR__ . '/../../config/module.config.php'; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
72 |
|
/** |
|
78
|
|
|
* {@inheritDoc} |
|
79
|
72 |
|
*/ |
|
80
|
|
|
public function getControllerConfig() |
|
81
|
|
|
{ |
|
82
|
|
|
return include __DIR__ . '/../../config/controllers.config.php'; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
72 |
|
/** |
|
86
|
|
|
* {@inheritDoc} |
|
87
|
72 |
|
*/ |
|
88
|
|
|
public function getModuleDependencies() |
|
89
|
|
|
{ |
|
90
|
|
|
return ['DoctrineModule']; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* @param EventInterface $event |
|
95
|
|
|
* @throws \Psr\Container\ContainerExceptionInterface |
|
96
|
|
|
* @throws \Psr\Container\NotFoundExceptionInterface |
|
97
|
18 |
|
*/ |
|
98
|
|
|
public function onBootstrap(EventInterface $event) |
|
99
|
|
|
{ |
|
100
|
18 |
|
/* @var $container ContainerInterface */ |
|
101
|
|
|
$container = $event->getTarget()->getServiceManager(); |
|
102
|
18 |
|
/* @var $doctrineCli Application */ |
|
103
|
|
|
$doctrineCli = $container->get('doctrine.cli'); |
|
104
|
|
|
|
|
105
|
18 |
|
$eventDispatcher = $container->get('doctrine.cli.event_dispatcher'); |
|
106
|
18 |
|
$doctrineCli->setDispatcher($eventDispatcher); |
|
107
|
18 |
|
} |
|
108
|
|
|
} |
|
109
|
|
|
|
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.