Share Models and Controllers

In multi module application, How can controller in one module access model and service in another module ?



259
edited Sep '15

You can make a common directory , and register it in Module.php ( with namespace)

Just register those models and services before registering modules.



48.3k

You should register almost all services in a generic config/services.php and then only register module specific services within a specific module. Someone once did an elaborate system where services could be run across modules but the default way that the Phalcon stack works is that only one module is being run at a given execution cycle. If you take this as fact in your system then you can provide services with the same name in different modules. Put everything in the generic config and then move to the modules as needed.