views:

53

answers:

1

Looking for some advice \ improvements on the structure of my application

user logs in and is presented with a welcome message and a menu of options each option points to the same controller e.g OptionController but with different actions

/option/abc
/option/def

OptionController.php
{
abcAction()
defAction()
}

the reason why I have different actions is because each option will require a different form

when the form is rendered and the user enters input the request is submitted to a validate controller again with a different action per option. i need basic form validation + custom business logic

I have it "working" but don't think it's a good way to do it. Thoughts?

+2  A: 

I would recommend a structure where you summarize not the art (display, validated) of task, but the, in your words, "options"

for example (:

controller: abcController
actions:    addAction()
            editAction()
            listAction()
            viewAction()
            deleteAction()


controller: defController
actions:    addAction()
            editAction()
            listAction()
            viewAction()
            deleteAction()

the configs for your forms (including validation) should be in own classes extended from Zend_Form which are stored in its own folder. eg APPLICATION_PATH.'/forms'. (see ZF - autoloader) displaying and validating forms can reside in the same action, i usaly split them into add and edit. (but using the same form class for both)

task's you need in all controllers are best to be implemented as action or view helpers.

Rufinus
maybe it would be better to split each option into its own controller. thanks
db83