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

Multi modules app - ControllerBase issue

Hi All,

I'm trying to push a bit Phalcon and see what it takes to build a multi-module architecture. So basically, 3 modules Frontend, Backend and API under /app, containing each a MVC sub tree.

So, after many attempts to get that to work, I got my router and Module.php files ok, added 3 names spaces for all that to work together (FE, FE\Controllers, FE\Models... BE, BE\Controllers, BE\Models... API, ...)

But now, I'm stuck with a ControllerBase issue. When Phalcon tries to acces my default controller (/app/FE/core/IndexController), I get the following error:

Fatal error: Cannot redeclare class FE\Controllers\ControllerBase in /www/app/FE/controllers/core/ControllerBase.php on line 83

"controllerBase.php line 83" is the closing bracket of my ControllerBase class. Couldn't find why it's included twice, or how to fix the issue. Has anyone encountered this issue before ?

Thanks.

Hi

Suggest you to review this project https://github.com/ovr/phalcon-module-skeleton, maybe it can help you with code examples



2.1k

i think its because of namespace. you already have a controller base declared somewhere in the same namespace.