Search code examples
propelzend-framework2

Adding Vendor Specific Module To Zend Framework 2.0


I have looked at some of the previous Stack posts out there on how to load a vendor library in ZF2, but I think they are a bit dated. I am trying to figure out how to add my vendor library "Propel" correctly.

I get an error from Zend Framework Saying "Unable to load 'Propel' Module"

Here is my setup.

In my application.config.php

return array(
'modules' => array(
    'Application',
    'Propel' // Module I am trying to add
),
'module_listener_options' => array(
    'config_glob_paths'    => array(    
        'config/autoload/{,*.}{global,local}.php',
    ),
    'module_paths' => array(
        './module',
        './vendor',
    ),
),

);

Here is the setup of my vendor directory

-Vendor
    -Propel
       -runtime
       -config
       -autoload_classmap.php
       -Module.php

Here is my Module.php

namespace ORM;

class Module
{
public function getAutoloaderConfig()
{
    return array(
        'Zend\Loader\ClassMapAutoloader' => array(
            __DIR__ . '/autoload_classmap.php',
        )
    );
}

public function getConfig()
{
    return include __DIR__ . '/config/module.config.php';
}
 }

Here is my autoload_classmap.php

// Generated by ZF2's ./bin/classmap_generator.php
return array(
    'Propel'                      => __DIR__ . '/runtime/lib/Propel.php'
);

Any ideas?


Solution

  • The namespace name must be "Propel". The folder name, module namespace name, and module name in the application.config.php must be EXACTLY the same.