向 Zend Framework 2.0 添加供应商特定模块 [英] Adding Vendor Specific Module To Zend Framework 2.0
问题描述
我已经查看了之前关于如何在 ZF2 中加载供应商库的一些 Stack 帖子,但我认为它们有点过时了.我想弄清楚如何正确添加我的供应商库Propel".
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.
我从 Zend Framework 收到一条错误消息,提示无法加载‘推进’模块"
I get an error from Zend Framework Saying "Unable to load 'Propel' Module"
这是我的设置.
在我的 application.config.php 中
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
这是我的 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';
}
}
这是我的 autoload_classmap.php
Here is my autoload_classmap.php
// Generated by ZF2's ./bin/classmap_generator.php
return array(
'Propel' => __DIR__ . '/runtime/lib/Propel.php'
);
有什么想法吗?
推荐答案
命名空间名称必须是Propel".application.config.php 中的文件夹名称、模块命名空间名称和模块名称必须完全相同.
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.
这篇关于向 Zend Framework 2.0 添加供应商特定模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!