[TYPO3-mvc] DDD approach for a questionnaire

Christine Gerpheide cgerpheide at gmail.com
Wed Jul 14 00:38:15 CEST 2010


Hi Pascal,


> The extension is organized as a questionnaire: there are like 15 steps,
> each one of these steps contains at least 10 questions that can be answered
> with yes or no.


The most natural approach to me seems to have a Step model and a Question
model (could be a ValueObject -- I am torn), where a Step has many
Questions.  The Question would store just the text for the question.
 Answers would be stored in something like a Response model, which has one
property for the Question, one to store the boolean answer, and maybe one to
store the user if you need it.  For the validation, you could probably do
something like when you submit one step, you run a custom validator that
makes sure each Question is filled out, possibly taking advantage of some of
the built in validation but I haven't done anything with custom validators
so I'm not sure.


> Depending on the answer, other questions like "If yes, when:" should pop
> up.
>
>
If they are consistently simple like "if yes when" then I would just add a
boolean property to the Question like "hasDescription" to control whether an
extra field is displayed on the FE.  Then the Response could have another
property "description" to store any elaboration like that.


>
> If this is too much meta-talk, let me know.
>

Well, I enjoy it at least, when I have time.  Given the short description
you have here, this is at least what comes to mind,
Christine


More information about the TYPO3-project-typo3v4mvc mailing list