Yes, it does seem a model will work but not entirely. Simple solution would be to create an action, for each module, that would create the necessary form and save the data, but that can get to complicated and time consuming.
I have used a model, like Admin_Model_Module, its job was to represent each module in my application. It was also responsible for install, update and uninstall of a module. Each Admin_Model_Module extended Admin_Model_Module_Interface, I could then call install on each and they could perform different functions, depending on what the module needed. I could then move duplicated code to the interface and have it available on each module. I would have to create a class for each module, but it solved my problem and gave me lots of flexibility. I think you have a good understanding of your problem and are justing going to have to start somewhere and work till you have the functionality needed. I would be interested in hearing your final solution, if you feel like emailing me once your done. On Jan 15, 2011, at 11:31 AM, Jurian Sluiman wrote: > Hi Shawn, > > Thanks for your comment (also on SO)! I understand your logic, but the origin > of my problem is I have a Blog module, Portfolio module, Contact module etc. > I'd like a loose coupling between these "content" modules and the Admin > module. So the admin acts like a front controller to fetch editable data from > the content modules and pass them back to save it again. > > In fact, I need an interface to communicate between them. I can use solely > models for that purpose, but the Blog_Model_Admin_Form needs to be in control > of saving, sanitizing, fetching data. That doesn't seem a role for a model to > me. > > Your idea seems a good suggestion, but I think it cannot completely fit on my > use case (because of the controller-like actions need to be done by a model). > > Regards, Jurian > -- > Jurian Sluiman > Soflomo - http://soflomo.com > > On Friday 14 Jan 2011 22:04:13 Shawn Ostler wrote: >> I believe you are confusing MVC modules and what you are calling "Page >> Modules". It sounds like you need one module and a few models. >> >> Pages_Model_Page has many Pages_Model_Module. >> >> Each, Pages_Model_Module, has one form (Pages_Form_Module_*) and getForm() >> method to get the form for the module. In the getForm() you can create a >> new instance of the "Module" form and fill it will the data for the >> "Module". >> >> Per "Page", get the "Modules", put each form, as a sub-form, in a standard >> Zend_Form and then pass to View. Upon submission, repeat above to build >> form, then validate. If valid, loop through each module and apply changes. >> >> With this approach you have one model and form for each "Page Module" >> (text,image,form,rss,video) and when you need a new one, you just create a >> model and form. >> >> >> Need further info, let me know. Shawn Ostler InclusiveDv [email protected] 801-688-6946
