View Revisions: Issue #17274

Summary 17274: Add a data-transfer object (DTO) for question attribute
Revision 2021-04-26 19:23 by ollehar
Description There's some serious domain confusion in the way question attributes were designed.

The class QuestionAttribute does NOT represent a question attribute BUT a question attribute VALUE.

TODO:

1) Rename QuestionAttribute model to QuestionAttributeValue

2) Add a new model or DTO for QuestionAttribute

Example: This function should return a QuestionAttribute (when defined correctly):

    public static function getDefaultSettings()
    {
        return array(
            "name" => null,
            "caption" => '',
            "inputtype" => "text",
            "options" => null,
            "category" => gT("Attribute"),
            "default" => '',
            "help" => '',
            "value" => '',
            "sortorder" => 1000,
            "i18n" => false,
            "readonly" => false,
            "readonly_when_active" => false,
            "expression" => null,
        );
    }

Also compare with participant attribute db design:

| lime_participant_attribute |
| lime_participant_attribute_names |
| lime_participant_attribute_names_lang |
| lime_participant_attribute_values |
Revision 2021-04-26 19:21 by ollehar
Description There's some serious domain confusion in the way question attributes were designed.

QuestionAttribute does NOT represent a question attribute BUT a question attribute VALUE.

TODO:

1) Rename QuestionAttribute model to QuestionAttributeValue

2) Add a new model or DTO for QuestionAttribute

Example: This function should return a QuestionAttribute (when defined correctly):

    public static function getDefaultSettings()
    {
        return array(
            "name" => null,
            "caption" => '',
            "inputtype" => "text",
            "options" => null,
            "category" => gT("Attribute"),
            "default" => '',
            "help" => '',
            "value" => '',
            "sortorder" => 1000,
            "i18n" => false,
            "readonly" => false,
            "readonly_when_active" => false,
            "expression" => null,
        );
    }