Does the ClassMapAutoloader need to be defined in every Module in ZF2?

35 Views Asked by At

Since the dynamic class loading with Zend\Loader\StandardAutoloader is very expensive, I generate a classmap and set it in the

Application\Module

public function getAutoloaderConfig()
{
    return [
        'Zend\Loader\ClassMapAutoloader' => [
            __DIR__ . '/../../data/cache' . '/' . 'autoload_classmap.application.php',
        ],
        'Zend\Loader\StandardAutoloader' => [
            'namespaces' => [
                __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                'MyNamespace' => __DIR__ . '/../../vendor/my/lib/src'
            ]
        ]
    ];
}

The file autoload_classmap.application.php contains a classmap for /module and /vendor/my/lib/src.

Is it enough to extend the getAutoloaderConfig() of only one module (e.g. Application) or do I need to do that in every the ClassMapAutoloader?

0

There are 0 best solutions below