Hash: SHA1
Scott Sowers wrote:
> Hi,
>
> 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/
Firstly, the default module doesn't sit under the modules directory with
the other modules. It is directly in the application directory (as
created by Zend_Tool and specified in the docs)
The models of the default module won't be prefixed by default, so they
will be in application/models/ and be called Model_*. However, I usually
namespace them with App_ (or the actual name of the app if there is one)
by adding:
protected function _initResourceAutoloader()
{
new Zend_Application_Module_Autoloader(array(
'basePath' => APPLICATION_PATH,
'namespace' => 'App',
));
}
to the default Bootstrap (application/Bootstrap.php)
- --
Brenton Alker
PHP Developer - Brisbane, Australia
http://blog.tekerson.com/
http://twitter.com/tekerson
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkqQuBIACgkQ7bkAtAithuvLhACfXBNKRzoEZMU1SEALCjs+LB2i
M8UAnReCiD9niSoIN0HYHte5cN/Pqhqv
=mmSw
-----END PGP SIGNATURE-----
没有评论:
发表评论