How do I add to the module_paths in my listenerOptions when I'm within
Module::init()?

I'm building module dependencies, and I need MyModule\Module to dynamically
add to the path and load ADependent module. The reason for adding to the
path is MyModule may be verion 2.1 of the module, and I need to make it
dependent on 2.1 of a dependent which resides in ADependent/2.1/Module.php.

Ideally, I'd like to say:

public function init(\Zend\ModuleManager\ModuleManager $moduleManger)
{

    $moduleManger->loadModule(array('Common' => '../module/Common/2.1');

}

I'm using the example code from the ModuleManager page to initially load
the modules:

// Instantiate and configure the default listener aggregate
$listenerOptions = new Listener\ListenerOptions(array(

    'module_paths' => array(
        './vendor',
        /* Explicit paths including version numbers to load. */
        // TODO: Make this version # dynamic based on called API.
        'Album' => './module/Album/2.1', // TODO: Make Album dependent on
Common 2.1, and autoload Common based on that?
    )

));
$defaultListeners = new Listener\DefaultListenerAggregate($listenerOptions);

// Instantiate the module manager
$moduleManager = new ModuleManager(array(

    'Album',

));

$moduleManager->getEventManager()->attachAggregate($defaultListeners);
$moduleManager->loadModules();

---
Philip
[email protected]
http://www.gpcentre.net/

Reply via email to