I have a multi-module app (modules: Core, Admin and Site) where Core module contains a certain model i would like to use in the router.
I'm not sure what is relevant and what isn't for you to help me with this.
In index.php I'm setting up services first (including the router), which are then passed to \Phalcon\Mvc\Application. Application then registeres modules:
$application->registerModules( 'core' => [ 'className' => 'Project\Core\Module', 'path' => APPROOT .'/modules/Core/Module.php' ], 'admin' => [ 'className' => 'Project\Admin\Module', 'path' => APPROOT .'/modules/Admin/Module.php' ], 'site' => [ 'className' => 'Project\Site\Module', 'path' => APPROOT .'/modules/Site/Module.php' ] )
I tride to use model from the Core module, like so:
$myModel = new Project\Core\Models\MyModel();
I just get the error that Model is not found. But it works for:
I don't understand why won't models work in the router. If I try to instantiate the same model somewhere else, it works as expected.