(on Saturday, 22 August 2009, 06:51 PM -0400):
> How would I call models from the default module and how do I name the
> model classes for the default module (I'm using ZF 1.8)? I understand
> how to do this for non-default modules, but I can't figure it out for
> default modules. I have the following directory structure:
>
> application/
> modules/
> default/
> models/
> controllers/
> views/
> admin/
> models/
> controllers/
> views/
With the directory structure you have above, I'll assume you also have
the following:
application/
Bootstrap.php
modules/
default/
Bootstrap.php -> Default_Bootstrap extends
Zend_Application_Module_Bootstrap
admin/
Bootstrap.php -> Admin_Bootstrap extends
Zend_Application_Module_Bootstrap
With current releases of ZF, the default module's bootstrap will not be
called; however, with current trunk and the upcoming 1.9.2, it will be.
In the meantime, if you add this code to application/Bootstrap.php, you
can get it to work:
protected function _initDefaultModule()
{
$this->bootstrap('FrontController');
require_once APPLICATION_PATH . '/modules/default/Bootstrap.php';
$defaultBootstrap = new Default_Bootstrap($this);
$defaultBootstrap->bootstrap();
return $defaultBootstrap;
}
In both cases, your models under that module should be prefixed with
"Default_" in order for autoloading to work correctly.
--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论