1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @link https://github.com/old-town/workflow-zf2-toolkit |
4
|
|
|
* @author Malofeykin Andrey <[email protected]> |
5
|
|
|
*/ |
6
|
|
|
namespace OldTown\Workflow\ZF2\Toolkit; |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
use OldTown\Workflow\ZF2\Toolkit\WorkflowRunParams\EntryIdResolver; |
10
|
|
|
use Zend\Mvc\ModuleRouteListener; |
11
|
|
|
use Zend\Mvc\MvcEvent; |
12
|
|
|
use Zend\EventManager\EventInterface; |
13
|
|
|
use Zend\ModuleManager\Feature\AutoloaderProviderInterface; |
14
|
|
|
use Zend\ModuleManager\Feature\ConfigProviderInterface; |
15
|
|
|
use Zend\ModuleManager\Feature\BootstrapListenerInterface; |
16
|
|
|
use Zend\ModuleManager\Feature\DependencyIndicatorInterface; |
17
|
|
|
|
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Class Module |
21
|
|
|
* |
22
|
|
|
* @package OldTown\Workflow\ZF2\Toolkit |
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_toolkit'; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @return array |
40
|
|
|
*/ |
41
|
|
|
public function getModuleDependencies() |
42
|
|
|
{ |
43
|
|
|
return [ |
44
|
|
|
'OldTown\\Workflow\\ZF2', |
45
|
|
|
'OldTown\\Workflow\\ZF2\\Service', |
46
|
|
|
'OldTown\\Workflow\\ZF2\\Dispatch', |
47
|
|
|
'OldTown\\Workflow\\Doctrine\\ZF2' |
48
|
|
|
]; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @param EventInterface $e |
53
|
|
|
* |
54
|
|
|
* @return array|void |
55
|
|
|
* |
56
|
|
|
* @throws \Zend\ServiceManager\Exception\ServiceNotFoundException |
57
|
|
|
*/ |
58
|
|
|
public function onBootstrap(EventInterface $e) |
59
|
|
|
{ |
60
|
|
|
/** @var MvcEvent $e */ |
61
|
|
|
$eventManager = $e->getApplication()->getEventManager(); |
62
|
|
|
$moduleRouteListener = new ModuleRouteListener(); |
63
|
|
|
$moduleRouteListener->attach($eventManager); |
64
|
|
|
|
65
|
|
|
$sm = $e->getApplication()->getServiceManager(); |
66
|
|
|
|
67
|
|
|
/** @var EntryIdResolver $entryIdResolver */ |
68
|
|
|
$entryIdResolver = $sm->get(EntryIdResolver::class); |
69
|
|
|
$eventManager->attach($entryIdResolver); |
|
|
|
|
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return mixed |
75
|
|
|
*/ |
76
|
|
|
public function getConfig() |
77
|
|
|
{ |
78
|
|
|
return include __DIR__ . '/config/module.config.php'; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @return array |
83
|
|
|
*/ |
84
|
|
|
public function getAutoloaderConfig() |
85
|
|
|
{ |
86
|
|
|
return array( |
87
|
|
|
'Zend\Loader\StandardAutoloader' => array( |
88
|
|
|
'namespaces' => array( |
89
|
|
|
__NAMESPACE__ => __DIR__ . '/src/', |
90
|
|
|
), |
91
|
|
|
), |
92
|
|
|
); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
} |
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: