Full name space of controller in dispatcher

Why should I provide the full name space of the controller to dispatch the route to ?

Not working example:

$dispatcher->forward([
    'contorller' => 'notFound',
    'action' => 'index',
    'params' => [$any]
]);

Working example:

$dispatcher->forward([
    'contorller' => 'Full\Namespace\Of\Controller\notFound',
    'action' => 'index',
    'params' => [$any]
]);

Phalcon version: 3.4.1

edited Aug '18

Because Dispatcher can forward calls to another module or CLI app etc.

You can simplify your code using Magic constants:

dispatcher->forward([
    'contorller' => __NAMESPACE__ . '\\' .  'notFound',
    ............
    .............
edited Aug '18

Last comment is true, but keep in mind it won't create module object, you need to create it yourself. You can also use parameter namespace to only provide namespace of controllers. Or even simpler use setDefaultNamespace on dispatcher and you won't need to provide full controller namespace.

$router->add( '/:namespace/admin/users/my-profile', [ 'namespace' => 1, 'controller' => 'Users', 'action' => 'profile', ] );

for more details of Namespse in C#