We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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.4k
Accepted
answer

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

NICE! Thanks! it works!