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

Can't make the switch from a single Module app to a Multi Module app

I setup an AWS EC2 instance, loaded up CentOS, PHP and Phalcon. Built my first single module test app using the docs, and all was well.

Then I thought I'd get all fancy and build a multi-module app, with the intent of putting in an API.

I've got a folder structure like this:

/var
  /app
    /current
     /my_app
      /multiple
       /apps
         /app0
         /app1

app0 and app1 are basically direct copies of the working single module app.

I have my index.php in /my_app It's a copy and edit of the one in the phalcon docs.

Everything seems ok until it fires echo $application->handle()->getContent(); Nothing happens. I echo some stuff right before it, and right after it, but the after echo never happens.

I didn't want to spam the post with code, but I can supply that if need be.

Thanks!

Jeff

It means you have error somewhere. Check a logs :)



6.6k
edited Mar '16

I got this in the log, but now I can't get it again: Declaration of Multiple\App0\Module::registerAutoloaders() must be compatible with Phalcon\Mvc\ModuleDefinitionInterface::registerAutoloaders(Phalcon\DiInterface $dependencyInjector = NULL) in Module.php on line 12

Nothing else is showing up. I set error reporting(E ALL); and I'm not getting anything.

So maybe fix it first ?



6.6k

I think I don't know enough to make it work at all. I reverted back to the single app which was working before and I'm going forward from there. Thank you for all the answers!

edited Mar '16

I've just taken a look at the docs and I've spotted an error. In your module class, replace this:

public function registerAutoloaders()

with...

public function registerAutoloaders(\Phalcon\DiInterface $di = null)

This should fix your problem. I'll fix the documentation tomorrow.