I can help give you some perspective with regards to ZF 1.10,
Zend_Application, and modules:
I have a project structure like so:
|- .zfproject.xml
|- application
| |- Bootstrap.php
| |- configs
| | `- application.ini
| |- controllers
| | |- ErrorController.php
| | `- IndexController.php
| |- models
| |- modules
| | `- guestbook
| | |- Bootstrap.php [Guestbook_Bootstrap]
| | |- controllers
| | | `- IndexController.php [Guestbook_IndexController]
| | |- models
| | | `- GuestbookMapper.php [Guestbook_Model_GuestbookMapper]
| | `- views
| | |- filters
| | |- helpers
| | `- scripts
| | `- index
| | `- index.phtml
| `- views
| |- helpers
| `- scripts
| |- error
| | `- error.phtml
| `- index
| `- index.phtml
`- public
|- .htaccess
`- index.php
The application.ini looks like this
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH
"/controllers"
resources.frontController.params.displayExceptions = 0
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] =
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
Important notes:
To have your module's assets autoloaded, you MUST have a bootstrap in
your module. In the above file list, you can see that it is located in
/application/modules/guestbook/Bootstrap.php, it's contents simply look
like this:
class Guestbook_Bootstrap extends Zend_Application_Module_Bootstrap
{
}
The presence of this file will register the module autoloader that will
do mappings outlined in this file:
http://framework.zend.com/svn/framework/standard/trunk/library/Zend/Application/Module/Autoloader.php
So, for example:
{ModuleName}_Model_SomeClass -> moduleName/models/SomeClass.php
{ModuleName}_Plugin_SomeClass -> moduleName/plugins/SomeClass.php
Hopefully, this will get you on the right track!
Good luck,
Ralph
I get the following error:
Fatal error: Class 'Modules_Guestbook_Model_GuestbookMapper' not found in
C:\Users\ben\Zend\workspaces\DefaultWorkspace\rebuild\application\modules\guestbook\controllers\GuestbookController.php
on line 7
GuestbookMapper.php (a model class):
class Guestbook_Application_Guestbook_Model_GuestbookMapper
{
protected $_dbTable;
public function setDbTable($dbTable) {
if(is_string($dbTable)) {
$dbTable = new $dbTable();
}
if(!$dbTable instanceof Zend_Db_Table_Abstract) {
throw new Exception('Invalid table data gateway
provided');
}
$this->_dbTable = $dbTable;
return $this;
}
....
}
I believe my limitation here is a misunderstanding of the routing and how
the app is trying to find the GuestbookMapper class and possibly the naming
scheme I should be using for the class itself, though I've played around
with a number of different ways of fixing that.
Any input on the specific technical issue I'm facing would be really
helpful. One caveat that I'm struggling with is that we have about five
developers building different modules and I'd like them to be doing as
little module-specific bootstrapping/configuration/etc as possible so they
can just build the meat of each module and drop it in, but I'm beyond my own
technical know-how at this point.
Thanks!