If the controller is defined in this way:
controllers' => array (
'invokables' => array (
'test' => 'Test\Controller\TestController',
));
then $MvcEvent->getRouteMatch()->getParam('controller') will return 'test' instead of 'Test\Controller\TestController'.
In this case module name can't be detected using explode by '\' cause will end in an error moduleName = controllerName (cause controller does not contain any '\')
NB: maybe is not the cleaner solution but can be a start point and it works :)
If the controller is defined in this way: controllers' => array ( 'invokables' => array ( 'test' => 'Test\Controller\TestController', )); then $MvcEvent->getRouteMatch()->getParam('controller') will return 'test' instead of 'Test\Controller\TestController'.
In this case module name can't be detected using explode by '\' cause will end in an error moduleName = controllerName (cause controller does not contain any '\')
NB: maybe is not the cleaner solution but can be a start point and it works :)