LimeSurvey API - Master branch

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

Methods

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>

initL10nService()

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
Question

storeNewQuestionData()

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
throws
PersistErrorException
Return values
Question

        
On this page

Search results