Hello, I do not understand the problem
my app throws: Dispatcher has detected a cyclic routing causing stability problems
in Security plugin
public function beforeDispatch(Event $event, Dispatcher $dispatcher)
{
$auth = $this->session->get('auth-identity');
if (!$auth) {
$dispatcher->forward(array(
'controller' => 'session',
'action' => 'login'
));
return false;
}
}
in services
$di->set('dispatcher', function() use ($di) {
$eventsManager = $di->getShared('eventsManager');
$security = new Security($di);
/**
* We listen for events in the dispatcher using the Security plugin
*/
$eventsManager->attach('dispatch', $security);
$dispatcher = new Dispatcher();
$dispatcher->setDefaultNamespace('App\Controllers');
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
});