Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>ZF 1.x is not really modular and I think modules in ZF 1.x are a bit of a misnomer. They are more like domain libraries in my opinion. With that being said, I look at code separation like this (pure opinion).</p> <ul> <li><p>Any code that I expect to be reused or reusable in another project I put in the library. eg. View helpers, action helpers, abstract model classes, base models, plugins etc...</p></li> <li><p>Any code that is application specific and will be used universally in the app I put in the application level directories. This is stuff like concrete data mappers, DbTable Models (I don't use Doctrine), forms and layouts...</p></li> <li><p>Any code that belongs specifically to a module(domain) and will not or cannot be used anywhere else I put in module level directories. This includes stuff like special view and action helpers, one of forms, and mostly it's where I put my domain(entity) models.</p></li> </ul> <p>To illustrate this I'll present an example (personal namespace omitted):<br /></p> <p>I have a module named <em>music</em> in my application, this module has a database table named <em>'music'</em>.<br /> so these are the files I might have to use this Db table in my module.<br /></p> <pre><code>//The DbTable model application /models /DbTable /Music.php //extends Zend_Db_Table_Abstract </code></pre> <p>To use that DbTable model I build a mapper that uses 2 files</p> <pre><code>//Base mapper class library /Application /Model /Mapper.php //The concrete mapper application /modules /models /MusicMapper.php //extends Namespace_Application_Model_Mapper </code></pre> <p>and to use that mapper I would have a domain model which is made up of 2 files, a base entity class and concrete entity class.</p> <pre><code>//Base entity class library /Application /Model /Entity.php //and the concrete entity class application /modules /models /Music.php //extends Namespace_Application_Model_Entity </code></pre> <p>I feel that organizing my files and classes this way keeps the code as DRY as possible without getting too confusing and scattered.<br /></p> <p>I hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload