Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dispatcher can't load Controller with additional namespace while using short syntax in router #333

Closed
applejohnny opened this issue Jan 16, 2013 · 2 comments

Comments

@applejohnny
Copy link

This code

$router->add(
    '/api/folder-list',
    [
        'controller' => 'Api\Folder',
        'action' => 'list'
    ]
)
    ->setName( 'api-folder-list' );

works fine, but this

$router->add(
    '/api/folder-list', 'Api\Folder::list'
)
    ->setName( 'api-folder-list' );

throws Phalcon\Mvc\Dispatcher\Exception with message 'Mail\Controllers\api\folderController handler class cannot be loaded' .

Version 0.8

@phalcon
Copy link
Collaborator

phalcon commented Jan 16, 2013

Hi Bekin, the namespace must be passed as a different parameter as explained here: http://docs.phalconphp.com/en/latest/reference/routing.html#routing-to-modules

$router->add('/api/folder-list', [
   'namespace' => 'Api\\',
   'controller' => 'folder',
   'action' => 'list'
])->setName( 'api-folder-list' );

@phongvt3110
Copy link

hi everyone,i downloaded HMVC phalcon from github and i ran it but i get this error after i ran composer install --no-dev command,i ran successfully phalcon framework with no HMVC but i want to try HMVC . The error i got below

Phalcon\Mvc\Dispatcher\Exception: IndexController handler class cannot be loaded File=/var/www/PhalconHMVC/public/index.php Line=28 #0 [internal function]: Phalcon\Mvc\Dispatcher->_throwDispatchException('IndexController...', 2) #1 [internal function]: Phalcon\Dispatcher->_dispatch() #2 [internal function]: Phalcon\Dispatcher->dispatch() #3 /var/www/PhalconHMVC/public/index.php(28): Phalcon\Mvc\Application->handle() #4 {main}

Can anyone tell me how to fix this error or how to run HMVC phalcon , i don't know how to run Hello world HMVC phalcon . Thanks advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants