2009年6月8日星期一

Re: [fw-mvc] Best practice for default module directory

-- David Mintz <vtbludgeon@gmail.com> wrote
(on Monday, 08 June 2009, 09:45 AM -0400):
>
>
> On Mon, Jun 8, 2009 at 9:08 AM, Matthew Weier O'Phinney <matthew@zend.com>
> wrote:
>
> Actually, Zend_Tool now has module support (as of 1.8.2). When you
> create a module, it places it in application/modules/<modulename>, and
> creates the appropriate directory structure.
>
> The default module is assumed to be directly under application/, and
> this is how Zend_Tool was written. The idea is that your default module
> is typically non-reusable, and very site-specific, and as such falls
> outside of your other modules (which should typically be re-usable).
>
> Woa -- run this by me again? I thought that if your app had modules, *all* your
> modules -- default included -- had to reside under a common directory, e.g.,
> application/modules. I further thought that the way your directory structure
> ends up after you create a module with the tool was just a flaw in the tool.
> You're saying the default module's controllers etc can simply be in application
> / while the foo module's files can be in application/modules/foo? Interesting!

This has been the design all along, actually. :)

The addModuleDirectory() method is simply a convenience method when you
have a number of modules under a common directory. You can achieve
similar functionality using setControllerDirectory() and passing an
array argument of moduleName => controller directory pairs -- which
allows you to have a completely custom directory layout if you so
desire.

Zend_Tool simply codifies what we've been trying (unsuccesfully, it
appears) to promote since adding module support in the 0.6 release.

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: