-- Bradley Holt <[EMAIL PROTECTED]> wrote (on Monday, 21 April 2008, 02:33 PM -0400): > This is a best-practices question which I can't seem to find a solid answer > to. > When using the modular directory structure, do you namespace the code in your > "models" directory and if so, how? In the example given in the documentation, > the controllers are namespaced. Blog_IndexController (located in the file > IndexController.php), for example, is the IndexController for the "blog" > module. Following this logic, it would make sense to also namespace the code > in > your "models". However, do you start out with a top-level directory for your > root namespace (as is done in components) like this: > > blog/models/Blog/Foo.php (class is Blog_Foo) > > or do you just assume that the top-level namespace is the same as the module > name: > > blog/models/Foo.php (class is still Blog_Foo) > > Which do you prefer? Is there a best-practice for this yet? If there is a > best-practice for this, then it should be added to the documentation (unless I > missed it?).
We haven't addressed naming conventions for models to date. However, I prefer the latter method, and there is already a proposal for a ModelLoader action helper that would also use the same conventions (i.e., Blog_Foo in blogs/models/Foo.php). Once we have an official component, the convention will be documented. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
