QuestionService
in package
Question Aggregate Service
Service class for editing question data.
Dependencies are injected to enable mocking.
Table of Contents
Properties
- $l10nService : L10nService
- $modelCondition : Condition
- $modelQuestion : Question
- $modelSurvey : Survey
- $proxyQuestion : ProxyQuestion
- $proxySettingsUser : ProxySettingsUser
- $yiiApp : LSYii_Application
Methods
- __construct() : mixed
- getQuestionAttributes() : array<string|int, QuestionAttribute>
- Returns all(!) question attributes to a question.
- getQuestionBySidAndQid() : Question
- Returns a question if it exists within the survey.
- save() : Question
- Based on QuestionAdministrationController::actionSaveQuestionData()
- initL10nService() : void
- Init L10nService for a question
- saveDefaults() : mixed
- Save defaults
- saveQuestionData() : Question
- Save question data
- storeNewQuestionData() : Question
- Method to store and filter data for a new question
- updateQuestionData() : Question
- Method to store and filter data for editing a question
Properties
$l10nService
private
L10nService
$l10nService
$modelCondition
private
Condition
$modelCondition
$modelQuestion
private
Question
$modelQuestion
$modelSurvey
private
Survey
$modelSurvey
$proxyQuestion
private
ProxyQuestion
$proxyQuestion
$proxySettingsUser
private
ProxySettingsUser
$proxySettingsUser
$yiiApp
private
LSYii_Application
$yiiApp
Methods
__construct()
public
__construct(Question $modelQuestion, Survey $modelSurvey, Condition $modelCondition, L10nService $l10nService, ProxySettingsUser $proxySettingsUser, ProxyQuestion $proxyQuestion, LSYii_Application $yiiApp) : mixed
Parameters
- $modelQuestion : Question
- $modelSurvey : Survey
- $modelCondition : Condition
- $l10nService : L10nService
- $proxySettingsUser : ProxySettingsUser
- $proxyQuestion : ProxyQuestion
- $yiiApp : LSYii_Application
getQuestionAttributes()
Returns all(!) question attributes to a question.
public
getQuestionAttributes(int $questionId) : array<string|int, QuestionAttribute>
The default scope on QuestionAttribute which is reset here caused missing data. We need to use this function in TransformerOutputSurveyDetail instead of accessing the attributes with "$questionModel->questionattributes"
Parameters
- $questionId : int
Return values
array<string|int, QuestionAttribute>getQuestionBySidAndQid()
Returns a question if it exists within the survey.
public
getQuestionBySidAndQid(int $sid, int $qid) : Question
Parameters
- $sid : int
- $qid : int
Tags
Return values
Questionsave()
Based on QuestionAdministrationController::actionSaveQuestionData()
public
save(mixed $input) : Question
Parameters
- $input : mixed
Tags
Return values
QuestioninitL10nService()
Init L10nService for a question
private
initL10nService(Survey $survey, int $questionId) : void
Parameters
- $survey : Survey
- $questionId : int
saveDefaults()
Save defaults
private
saveDefaults(mixed $data) : mixed
Parameters
- $data : mixed
saveQuestionData()
Save question data
private
saveQuestionData(array<string|int, mixed> $data, int $questionGroupId) : Question
Parameters
- $data : array<string|int, mixed>
- $questionGroupId : int
Return values
QuestionstoreNewQuestionData()
Method to store and filter data for a new question
private
storeNewQuestionData([array<string|int, mixed> $data = null ][, bool $subQuestion = false ]) : Question
Parameters
- $data : array<string|int, mixed> = null
- $subQuestion : bool = false
Tags
Return values
QuestionupdateQuestionData()
Method to store and filter data for editing a question
private
updateQuestionData(Question $question, array<string|int, mixed> $data) : Question
Parameters
- $question : Question
- $data : array<string|int, mixed>