Skip to content

Commit

Permalink
Merge pull request #14 from Mattin/zend_2.5_compatibility_fix
Browse files Browse the repository at this point in the history
ZF2.5 and newer compatibility fix
  • Loading branch information
Rastusik authored Sep 15, 2016
2 parents 26dc007 + 1f41f28 commit 90a945b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
*/
namespace DI\ZendFramework2;

// compatibility with zend > 2.5
$controllerType = 'ControllerLoader';
if (class_exists('\Zend\Version\Version')) {
$version = new \Zend\Version\Version();
if ($version::compareVersion('2.5.0') <= 0) {
$controllerType = 'ControllerManager';
}
}

return [
'controllers' => [
'invokables' => [
Expand All @@ -21,7 +30,7 @@
),

'factories' => [
'ControllerLoader' => __NAMESPACE__ . '\\Service\\ControllerLoaderFactory',
$controllerType => __NAMESPACE__ . '\\Service\\ControllerLoaderFactory',
'DiCache' => __NAMESPACE__ . '\\Service\\CacheFactory',
],
],
Expand Down

0 comments on commit 90a945b

Please sign in to comment.