AttributesService
in package
Question Aggregate Attributes Service
Service class for editing question attributes data.
Based on QuestionAdministrationController::unparseAndSetAdvancedOptions()
Table of Contents
Properties
- $modelQuestionAttribute : QuestionAttribute
- $modelSurvey : Survey
- $questionAttributeHelper : QuestionAttributeHelper
Methods
- __construct() : mixed
- sanitizeAttributesByType() : void
- Removes question attributes from the database that are not valid for the question's current type. This prevents orphaned attributes from a previous question type from interfering with the current type.
- save() : void
- Saves the base attributes of questions as they come in
- saveAdvanced() : void
- Based on QuestionAdministrationController::unparseAndSetAdvancedOptions() Saves the advanced question attributes as they are in the $dataSet array
- saveMissingAttributes() : Question
- Adds missing question attributes with default values to the passed question
Properties
$modelQuestionAttribute
private
QuestionAttribute
$modelQuestionAttribute
$modelSurvey
private
Survey
$modelSurvey
$questionAttributeHelper
private
QuestionAttributeHelper
$questionAttributeHelper
Methods
__construct()
public
__construct(QuestionAttribute $modelQuestionAttribute, QuestionAttributeHelper $questionAttributeHelper, Survey $modelSurvey) : mixed
Parameters
- $modelQuestionAttribute : QuestionAttribute
- $questionAttributeHelper : QuestionAttributeHelper
- $modelSurvey : Survey
sanitizeAttributesByType()
Removes question attributes from the database that are not valid for the question's current type. This prevents orphaned attributes from a previous question type from interfering with the current type.
public
sanitizeAttributesByType(Question $question) : void
Parameters
- $question : Question
save()
Saves the base attributes of questions as they come in
public
save(Question $question, mixed $dataSet) : void
Parameters
- $question : Question
- $dataSet : mixed
Tags
saveAdvanced()
Based on QuestionAdministrationController::unparseAndSetAdvancedOptions() Saves the advanced question attributes as they are in the $dataSet array
public
saveAdvanced(Question $question, mixed $dataSet) : void
Parameters
- $question : Question
- $dataSet : mixed
Tags
saveMissingAttributes()
Adds missing question attributes with default values to the passed question
public
saveMissingAttributes(Question $question, int $surveyId) : Question
Parameters
- $question : Question
- $surveyId : int