To achieve what you want you need this in Module.php
:
namespace Foo;
use Zend\ModuleManager\ModuleEvent;
use Zend\ModuleManager\ModuleManager;
class Module
{
public function init(ModuleManager $moduleManager)
{
$events = $moduleManager->getEventManager();
// Registering a listener at default priority, 1, which will trigger
// after the ConfigListener merges config.
$events->attach(ModuleEvent::EVENT_MERGE_CONFIG, array($this, 'onMergeConfig'));
}
public function onMergeConfig(ModuleEvent $e)
{
$configListener = $e->getConfigListener();
$config = $configListener->getMergedConfig(false);
// Modify the configuration; here, we'll remove a specific key:
if (isset($config['router']['routes']['your_route'])) {
unset($config['router']['routes']['your_route']);
}
// Pass the changed configuration back to the listener:
$configListener->setMergedConfig($config);
}
}
It is just example. You need to change yout_route
to that part of array, which represents /user/list
.