LimeSurvey API - Master branch

OpHandlerQuestionGroup
in package
implements OpHandlerInterface Uses OpHandlerSurveyTrait, OpHandlerExceptionTrait, OpHandlerValidationTrait

Table of Contents

Interfaces

OpHandlerInterface

Properties

$entity  : string
$model  : QuestionGroup
$questionGroupService  : QuestionGroupService
$transformer  : TransformerInputQuestionGroupAggregate
$isCreateOperation  : bool
$isDeleteOperation  : bool
$isUpdateOperation  : bool

Methods

__construct()  : mixed
addErrorToValidationData()  : array<string|int, mixed>
Adds the error message to the validationData array
canHandle()  : bool
Checks if the operation is applicable for the given entity.
extractTempId()  : int|mixed
returns and removes tempId from dataset
getSurveyIdFromContext()  : int
Extracts and returns surveyId from context
getValidationReturn()  : array<string|int, mixed>|array<string|int, array<string|int, ValidationErrorItem>>
handle()  : array<string|int, mixed>
Saves the changes to the database.
setOperationTypes()  : void
Reads the operation type from the given operation, and sets the corresponding flags.
validateCollection()  : array<string|int, mixed>
checks incoming props if it's a collection otherwise adds error to validationData.
validateCollectionIndex()  : array<string|int, mixed>
validates for collection first and then checks the indexes to be numeric or alphabetic dependent on the alphabetic flag
validateEntityId()  : array<string|int, mixed>
checks for entity id being there, otherwise adds error to validationData
validateOperation()  : array<string|int, mixed>
Checks if patch is valid for this operation.
create()  : array<string|int, mixed>
To fully create a new question group, the dataset should have this structure for props:
delete()  : void
To delete a question group, the dataset should look like this { "patch": [ { "entity": "questionGroup", "op": "delete", "id": 7 } ] }
throwNoValuesException()  : void
update()  : void
Update question group

Properties

Methods

addErrorToValidationData()

Adds the error message to the validationData array

public addErrorToValidationData(string $error, array<string|int, mixed> $validationData) : array<string|int, mixed>
Parameters
$error : string
$validationData : array<string|int, mixed>
Return values
array<string|int, mixed>

extractTempId()

returns and removes tempId from dataset

public extractTempId(array<string|int, mixed> &$dataSet) : int|mixed
Parameters
$dataSet : array<string|int, mixed>
Return values
int|mixed

validateCollection()

checks incoming props if it's a collection otherwise adds error to validationData.

public validateCollection(OpInterface $op, array<string|int, mixed> $validationData) : array<string|int, mixed>

Basically this only check for the incoming props being a multidimensional array.

Parameters
$op : OpInterface
$validationData : array<string|int, mixed>
Return values
array<string|int, mixed>

validateCollectionIndex()

validates for collection first and then checks the indexes to be numeric or alphabetic dependent on the alphabetic flag

public validateCollectionIndex(OpInterface $op, array<string|int, mixed> $validationData[, bool $alphabetic = true ]) : array<string|int, mixed>
Parameters
$op : OpInterface
$validationData : array<string|int, mixed>
$alphabetic : bool = true
Return values
array<string|int, mixed>

validateEntityId()

checks for entity id being there, otherwise adds error to validationData

public validateEntityId(OpInterface $op, array<string|int, mixed> $validationData) : array<string|int, mixed>
Parameters
$op : OpInterface
$validationData : array<string|int, mixed>
Return values
array<string|int, mixed>

create()

To fully create a new question group, the dataset should have this structure for props:

private create(OpInterface $op) : array<string|int, mixed>

{ "patch": [ { "entity": "questionGroup", "op": "create", "props":{ "questionGroup": { "tempId": 777, "randomizationGroup": "", "gRelevance": "" }, "questionGroupL10n": { "en": { "groupName": "3rd Group", "description": "English" }, "fr": { "groupName": "Troisième Groupe", "description": "French" } } } } ] }

If those questionGroup and questionGroupL10n properties are missing, and the structure resembles the usual update structure, only a basic question group will be created. Language specific data must then be passed in a different patch operation.

Parameters
$op : OpInterface
Tags
throws
OpHandlerException
throws
NotFoundException
throws
PersistErrorException
Return values
array<string|int, mixed>

update()

Update question group

private update(OpInterface $op) : void

For update of a question group the patch should look like this: { "patch": [ { "entity": "questionGroup", "op": "update", "id": 7, "props": { "questionGroup": { "randomizationGroup": "", "gRelevance": "" }, "questionGroupL10n": { "en": { "groupName": "3rd Group - updated", "description": "English" }, "fr": { "groupName": "Troisième Groupe - updated", "description": "French" } } } } ] }

Parameters
$op : OpInterface
Tags
throws
OpHandlerException
throws
NotFoundException
throws
PermissionDeniedException
throws
PersistErrorException

        
On this page

Search results