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.

Multiple Modules - Shared Model?

I have seen how you can share common layouts in two different modules views.

How can I share the same model directory. Or is the point that seperating modules forces you into seperating your models?

Is it valid to want to have two seperate modules when you only to seperate controllers and views.



37.4k
edited Sep '15

https://docs.phalconphp.com/en/latest/reference/applications.html

In Backend\Module.php set the models namespace to the common directory:

$loader->registerNamespaces(
            array(
                'Multiple\Backend\Controllers' => '../apps/backend/controllers/',
                'Multiple\Backend\Models'      => '../apps/common/models/',
            )
        );


34.2k
Accepted
answer

There are many examples in the MVC sample that can help you: https://github.com/phalcon/mvc#phalcon-mvc-examples