I spent some time researching on modular programming, as I was trying to implement a plug-in architecture inside a modular system. I found a very interesting way of allowing other developers to plug-in code to a specific module:


ZF maps actions to methods, so I added the possibility to map actions to classes as well. For example, if you have a modular system that uses the MVC pattern, and you add a directory to your module called: actions/:



application/

   blog/

       actions/

       controllers/

       models/

       views/



This means that the dispatcher not only maps a request to an action controller class method, but also to a class inside the actions/ directory that extends the action controller method class. For example: If the editAction() method is not found in the BlogController class, it will try to map to a class named BlogActionsEdit that extends BlogController, inside the actions/ directory. This way you can plug code to a controller using polymorphism.





Federico





----- Original Message ----- From: "Jack Sleight" <[EMAIL PROTECTED]>
Cc: "Zend Framework" <[email protected]>
Sent: Monday, December 03, 2007 3:52 PM
Subject: Re: [fw-general] Using Zend_Config / Changing a module behaviour


I was actually wondering about a similar thing. Has anyone thought about/explored the possibility of having a generic module, that you could then "extend" in the same way you think of "extending" a class? I'm talking about the ability to extend an entire module: models, views and controllers. This can already be done with views (by adding multiple view paths to provide custom templates), but what about controllers and models, say if you wanted to "extend" the database schema and add some custom logic to a controller? You obviously cant have multiple classes (for controllers and models) with the same name, so I've no idea how this could work.

Does anyone have an thoughts of how, or even if you should do this, and how it might fit within the way ZF already functions?
Thanks,
--
Jack

Reply via email to