These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace DoctrineModule; |
||
6 | |||
7 | use Doctrine\Common\Annotations\AnnotationRegistry; |
||
8 | use DoctrineModule\Component\Console\Output\PropertyOutput; |
||
9 | use Laminas\Console\Adapter\AdapterInterface as Console; |
||
10 | use Laminas\EventManager\EventInterface; |
||
11 | use Laminas\ModuleManager\Feature\BootstrapListenerInterface; |
||
12 | use Laminas\ModuleManager\Feature\ConfigProviderInterface; |
||
13 | use Laminas\ModuleManager\Feature\InitProviderInterface; |
||
14 | use Laminas\ModuleManager\ModuleManagerInterface; |
||
15 | use Laminas\ServiceManager\ServiceLocatorInterface; |
||
16 | use Symfony\Component\Console\Input\StringInput; |
||
17 | use function class_exists; |
||
18 | |||
19 | /** |
||
20 | * Base module for integration of Doctrine projects with ZF2 applications |
||
21 | * |
||
22 | * @link http://www.doctrine-project.org/ |
||
23 | */ |
||
24 | class Module implements ConfigProviderInterface, InitProviderInterface, BootstrapListenerInterface |
||
25 | { |
||
26 | /** @var ServiceLocatorInterface */ |
||
27 | private $serviceManager; |
||
28 | |||
29 | /** |
||
30 | * {@inheritDoc} |
||
31 | */ |
||
32 | 30 | public function init(ModuleManagerInterface $moduleManager) |
|
33 | { |
||
34 | 30 | AnnotationRegistry::registerLoader( |
|
0 ignored issues
–
show
|
|||
35 | static function ($className) { |
||
36 | return class_exists($className); |
||
37 | 30 | } |
|
38 | ); |
||
39 | 30 | } |
|
40 | |||
41 | /** |
||
42 | * {@inheritDoc} |
||
43 | */ |
||
44 | 1 | public function onBootstrap(EventInterface $event) |
|
45 | { |
||
46 | 1 | $this->serviceManager = $event->getTarget()->getServiceManager(); |
|
47 | 1 | } |
|
48 | |||
49 | /** |
||
50 | * {@inheritDoc} |
||
51 | */ |
||
52 | 31 | public function getConfig() |
|
53 | { |
||
54 | 31 | $provider = new ConfigProvider(); |
|
55 | |||
56 | return [ |
||
57 | 31 | 'doctrine' => $provider->getDoctrineConfig(), |
|
58 | 31 | 'doctrine_factories' => $provider->getDoctrineFactoryConfig(), |
|
59 | 31 | 'service_manager' => $provider->getDependencyConfig(), |
|
60 | 31 | 'controllers' => $provider->getControllerConfig(), |
|
61 | 31 | 'route_manager' => $provider->getRouteManagerConfig(), |
|
62 | 31 | 'console' => $provider->getConsoleConfig(), |
|
63 | 31 | 'validators' => $provider->getValidatorConfig(), |
|
64 | ]; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * {@inheritDoc} |
||
69 | */ |
||
70 | 1 | public function getConsoleUsage(Console $console) |
|
71 | { |
||
72 | 1 | $cli = $this->serviceManager->get('doctrine.cli'); |
|
73 | 1 | $output = new PropertyOutput(); |
|
74 | |||
75 | 1 | $cli->run(new StringInput('list'), $output); |
|
76 | |||
77 | 1 | return $output->getMessage(); |
|
78 | } |
||
79 | } |
||
80 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.