so I do the registering to handle 404 error:
<?php
public function registerServices(\Phalcon\DiInterface $di)
{
$di->set('dispatcher', function() use ($di) {
$dispatcher = new \Phalcon\Mvc\Dispatcher();
$dispatcher->setDefaultNamespace('Application\My\Controllers');
$evManager = $di->getShared('eventsManager');
$evManager->attach('dispatch:beforeException', function($event, $dispatcher, $exception) {
switch ($exception->getCode())
{
case \Phalcon\Mvc\Dispatcher::EXCEPTION_HANDLER_NOT_FOUND:
case \Phalcon\Mvc\Dispatcher::EXCEPTION_ACTION_NOT_FOUND:
$dispatcher->forward(array(
'namespace' => 'Application\My\Controllers',
'controller' => 'errors',
'action' => 'show404'
));
return false;
}
});
$dispatcher->setEventsManager($evManager);
return $dispatcher;
});
}
and now the views/errors/show404.phtml runs - however, controllers/ErrorsController::show404Action win NOT. Interestingly, if I remove/rename show404Action method, it chrashes.