Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Phalcon2: Cannot call class defined in global loader

Hi everyone!

I have a little problem with registered namespaces using global loader. I have a namespace called App\Library and registered with global loader. Then I want to use it inside the one of my module's controller but unfortunately it did not work - even I have tried registered the App\Library using module loader, but still not working.

Suppose when I call App\Library\ModuleManager::getModuleList() it will get to the App\Library namespace, but it seems to load from module's namespace - Mod\ModMan\Controllers\App\Library\ModuleManager. See attached screenshots.

Error Message Screenshot

The Codes

Thanks.



6.3k
Accepted
answer

App\Library\ModuleManager sentence is not right, must be Library\ModuleManager or \App\Library\ModuleManager

NICE! Thanks! it works!