-
Notifications
You must be signed in to change notification settings - Fork 11
Milestones
List view
Yesterday I wanted to add a new validation in the administration module. I added it to the Webdesktop layer, but of course wasn't available in the "website" Admin module. This "editing multiple modules to have the same functionality in all of them" should be fixed. What does that mean? ------------------------------ Well, first: Introduce a new layer between controller and view. This could be something like the Domain Model Gateway (see http://weierophinney.net/matthew/archives/202-Model-Infrastructure.html). * "n" number of modules use one model and they push just their data received from the request to this model. * The Model Gateway performs the desired action on the data and return the result or a success property * The controller returns the result to the user Because two different technologies are used (JSON/simple HTTP GET/POST) the controller needs to detect the type of call Call types: * XML HTTP Request * HTTP Request Because I'm not sure if the XML Request is always detectable, use a special URL. Currently the URLs looke like /admin/user/edit/<id> // direkt http admin module /webdesktop/api/request/_module/administration/_action/saveEditUser With admin|webdesktop => module user|api => controller edit|request => action _module|_action => params to route in the webdesktop/api controller Both types of modules should point to the same URL and the controller/action should serve the correct response /admin/user/<action>/ [id/123] As stated above, I don't know if detected the request type always work, there could be a solution with a basic ZF Tool: Routing The solution could be /admin/user/<action> => for normal HTTP Requests /api/admin/user/<action> With admin => module user => controller <action> => action The "api" in the URL should be removed in the rewrite router and set the "isXMLHttpRequest" to true. Impact of this change ----------------------------- This is huge and it essentially means: Rewrite all (well, just change URLs in the ExtJS4 Part). As an example for the administration module: * consolidate the functionality or map the functionality from one to an other * controller must respond base on the request * disableLayout() and setNoRenderer() for JSON * Write the router * write the GateWay Model * ... and *a lot* more The Domain Model Gateway should have all the logic regarding to the data that is processed. The Controller is more like a switch that receives from different "sources" (HTML forms/XMLHTTPRequests), handover to the Gateway, receive the results and push it back to the "source". Another target is here, to keep the controller as small as possible and not put any user data related logic in the controller. And why not change more? ------------------------------------- * It is possible. I introduced the "DbRow" mapping classes, that maps keywords in the controller with database column names to remove the db related informations from the controller/models. I just find out, that you can configure custom DB_TableRow/RowSet with Zend_Db. The mapping could be done in this layer, maybe call it Entity and not DbRow?! * more that I cannot think about at the moment :) This will of course get a new tag => v0.2 if everything works
Overdue by 15 year(s)•Due by September 30, 2011