|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @author Matthias Glaub <[email protected]> |
|
5
|
|
|
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace MaglLegacyApplication; |
|
9
|
|
|
|
|
10
|
|
|
use MaglLegacyApplication\Application\MaglLegacy; |
|
11
|
|
|
use Zend\Mvc\MvcEvent; |
|
12
|
|
|
use Zend\Mvc\Router\RouteMatch; |
|
13
|
|
|
use Zend\ServiceManager\ServiceManager; |
|
14
|
|
|
|
|
15
|
|
|
class Module |
|
16
|
|
|
{ |
|
17
|
4 |
|
public function onBootstrap(MvcEvent $event) |
|
18
|
|
|
{ |
|
19
|
4 |
|
MaglLegacy::getInstance()->setApplication($event->getApplication()); |
|
20
|
4 |
|
} |
|
21
|
|
|
|
|
22
|
5 |
|
public function getConfig() |
|
23
|
|
|
{ |
|
24
|
5 |
|
return include realpath(__DIR__ . '/../../config/module.config.php'); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
5 |
|
public function getControllerConfig() |
|
28
|
|
|
{ |
|
29
|
|
|
return array( |
|
30
|
|
|
'factories' => array( |
|
31
|
|
|
'MaglLegacyApplication\Controller\Legacy' => function ($sl) { |
|
32
|
5 |
|
$options = $sl->getServiceLocator()->get('MaglLegacyApplicationOptions'); |
|
33
|
|
|
|
|
34
|
5 |
|
$legacyApp = Application\MaglLegacy::getInstance(); |
|
35
|
|
|
|
|
36
|
5 |
|
return new \MaglLegacyApplication\Controller\LegacyController($options, $legacyApp); |
|
37
|
|
|
} |
|
38
|
5 |
|
) |
|
39
|
5 |
|
); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
5 |
|
public function getServiceConfig() |
|
43
|
|
|
{ |
|
44
|
|
|
return array( |
|
45
|
|
|
'factories' => array( |
|
46
|
|
|
'MaglLegacyApplicationOptions' => function ($sl) { |
|
47
|
5 |
|
$config = $sl->get('Config'); |
|
48
|
5 |
|
$options = $config['magl_legacy_application']; |
|
49
|
|
|
|
|
50
|
5 |
|
return new Options\LegacyControllerOptions($options); |
|
51
|
5 |
|
}, |
|
52
|
1 |
|
'MaglControllerService' => function (ServiceManager $sl) { |
|
53
|
|
|
|
|
54
|
1 |
|
$eventManager = $sl->get('Application')->getEventManager(); |
|
55
|
|
|
|
|
56
|
1 |
|
$event = new \Zend\Mvc\MvcEvent(); |
|
57
|
1 |
|
$event->setApplication($sl->get('Application')); |
|
|
|
|
|
|
58
|
1 |
|
$event->setTarget($sl->get('Application')); |
|
|
|
|
|
|
59
|
1 |
|
$event->setRequest($sl->get('Request')); |
|
|
|
|
|
|
60
|
1 |
|
$event->setRouter($sl->get('Router')); |
|
|
|
|
|
|
61
|
1 |
|
$event->setRouteMatch(new RouteMatch(array())); |
|
62
|
|
|
|
|
63
|
1 |
|
return new Service\ControllerService($eventManager, $event); |
|
64
|
|
|
} |
|
65
|
5 |
|
) |
|
66
|
5 |
|
); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
5 |
|
public function getAutoloaderConfig() |
|
70
|
|
|
{ |
|
71
|
|
|
return array( |
|
72
|
|
|
'Zend\Loader\StandardAutoloader' => array( |
|
73
|
|
|
'namespaces' => array( |
|
74
|
5 |
|
__NAMESPACE__ => __DIR__, |
|
75
|
5 |
|
), |
|
76
|
5 |
|
), |
|
77
|
5 |
|
); |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|
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: