1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @link https://github.com/old-town/workflow-zf2-dispatch |
4
|
|
|
* @author Malofeykin Andrey <[email protected]> |
5
|
|
|
*/ |
6
|
|
|
namespace OldTown\Workflow\ZF2\Dispatch; |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
use Zend\Mvc\ModuleRouteListener; |
10
|
|
|
use Zend\Mvc\MvcEvent; |
11
|
|
|
use Zend\EventManager\EventInterface; |
12
|
|
|
use Zend\ModuleManager\Feature\AutoloaderProviderInterface; |
13
|
|
|
use Zend\ModuleManager\Feature\ConfigProviderInterface; |
14
|
|
|
use Zend\ModuleManager\Feature\BootstrapListenerInterface; |
15
|
|
|
use Zend\ModuleManager\Feature\DependencyIndicatorInterface; |
16
|
|
|
use OldTown\Workflow\ZF2\Dispatch\Listener\WorkflowDispatchListener; |
17
|
|
|
|
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Class Module |
21
|
|
|
* |
22
|
|
|
* @package OldTown\Workflow\ZF2 |
23
|
|
|
*/ |
24
|
|
|
class Module implements |
25
|
|
|
BootstrapListenerInterface, |
26
|
|
|
ConfigProviderInterface, |
27
|
|
|
AutoloaderProviderInterface, |
28
|
|
|
DependencyIndicatorInterface |
29
|
|
|
{ |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Имя секции в конфиги приложения |
33
|
|
|
* |
34
|
|
|
* @var string |
35
|
|
|
*/ |
36
|
|
|
const CONFIG_KEY = 'workflow_zf2_dispatch'; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @return array |
40
|
|
|
*/ |
41
|
|
|
public function getModuleDependencies() |
42
|
|
|
{ |
43
|
|
|
return [ |
44
|
|
|
'OldTown\\Workflow\\ZF2' |
45
|
|
|
]; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @param EventInterface $e |
50
|
|
|
* |
51
|
|
|
* @return array|void |
52
|
|
|
* |
53
|
|
|
* @throws \Zend\ServiceManager\Exception\ServiceNotFoundException |
54
|
|
|
*/ |
55
|
|
|
public function onBootstrap(EventInterface $e) |
56
|
|
|
{ |
57
|
|
|
/** @var MvcEvent $e */ |
58
|
|
|
$eventManager = $e->getApplication()->getEventManager(); |
59
|
|
|
$moduleRouteListener = new ModuleRouteListener(); |
60
|
|
|
$moduleRouteListener->attach($eventManager); |
61
|
|
|
|
62
|
|
|
/** @var WorkflowDispatchListener $injectWorkflowListener */ |
63
|
|
|
$injectWorkflowListener = $e->getApplication()->getServiceManager()->get(WorkflowDispatchListener::class); |
64
|
|
|
$eventManager->attach($injectWorkflowListener); |
|
|
|
|
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return mixed |
70
|
|
|
*/ |
71
|
|
|
public function getConfig() |
72
|
|
|
{ |
73
|
|
|
return include __DIR__ . '/config/module.config.php'; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return array |
78
|
|
|
*/ |
79
|
|
|
public function getAutoloaderConfig() |
80
|
|
|
{ |
81
|
|
|
return array( |
82
|
|
|
'Zend\Loader\StandardAutoloader' => array( |
83
|
|
|
'namespaces' => array( |
84
|
|
|
__NAMESPACE__ => __DIR__ . '/src/', |
85
|
|
|
), |
86
|
|
|
), |
87
|
|
|
); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
} |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: