Roger,

If you already have the module path detection, i guess i have nothing to add
really :).

We're doing something similar where we have an AbstractModule that
automatically figures out the module path and sets up the
getAutoloaderConfig and getConfig methods with sane defaults. This way other
Module classes extending from this base class don't need to do anything.

We have 3 getPath(), getName(), and getRootPath() methods in the
AbstractModule:

getName()
{
    $ref = new ReflectionClass($this);
    return $ref->getNamespaceName();
}

getPath()
{
    $ref = new ReflectionClass($this);
    return dirname($ref->getFileName());
}

getRootPath()
{
    return dirname(dirname($this->getPath()));
}

The getAutoloaderConfig() and getConfig() methods then look like this:

getAutoloaderConfig()
{
    return array(
        $this->getName() => $this->getPath(),
    );
}

getConfig()
{
    return include $this->getRootPath() .'/config/module.config.php';
}




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Access-the-module-manager-reference-in-the-constructor-of-a-module-class-tp4659794p4659883.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to