Hi all,
On a multi-module application I'm triying to share services, but it seems that the autoloader defined in each Module.php works overriding the global one. For example:
I use a global loader for the application on the bootstrap.
<?php
$loader = new \Phalcon\Loader();
$loader->registerNamespaces(array(
'MyApp\Base\Controllers' => __DIR__ . '../apps/base/controllers/'
));
$loader->register();
And new loaders on each module. (using Module.php)
<?php
public function registerAutoloaders(DiInterface $dependencyInjector = NULL)
{
$loader = new \Phalcon\Loader();
$loader->registerNamespaces(array( 'MyApp\User\Controllers' => __DIR__ . 'controllers/'
));
$loader->register();
}
if I load the base module as default then MyApp\Base\Controllers are accesible. But they become unreachable when I use another module with its own autoloader and namespace.
Is the a way to avoid using a global autoloader for all my modules? Can I add namespaces to a global autoloader or stack them during process time?
first post so I would like to thank you all, the Phalcon Framework community, for all your efforts.