OpHandlerLanguageSettingsUpdate
in package
implements
OpHandlerInterface
Uses
OpHandlerSurveyTrait, OpHandlerExceptionTrait, OpHandlerValidationTrait
Table of Contents
Interfaces
Properties
- $entity : string
- $model : SurveyLanguageSetting
- $transformer : TransformerInterface
Methods
- __construct() : mixed
- addErrorToValidationData() : array<string|int, mixed>
- Adds the error message to the validationData array
- canHandle() : bool
- 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() : void
- This handler accepts two different approaches to update the language settings: Approach 1 (single language): - in this case the language needs to be part of the id array - patch structure: { "entity": "languageSetting", "op": "update", "id": "de", "props": { "title": "Beispielfragebogen" } }
- 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.
- throwNoValuesException() : void
Properties
$entity
protected
string
$entity
$model
protected
SurveyLanguageSetting
$model
$transformer
protected
TransformerInterface
$transformer
Methods
__construct()
public
__construct(SurveyLanguageSetting $model, TransformerInputSurveyLanguageSettings $transformer) : mixed
Parameters
- $model : SurveyLanguageSetting
- $transformer : TransformerInputSurveyLanguageSettings
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>canHandle()
public
canHandle(OpInterface $op) : bool
Parameters
- $op : OpInterface
Return values
boolextractTempId()
returns and removes tempId from dataset
public
extractTempId(array<string|int, mixed> &$dataSet) : int|mixed
Parameters
- $dataSet : array<string|int, mixed>
Return values
int|mixedgetSurveyIdFromContext()
Extracts and returns surveyId from context
public
getSurveyIdFromContext(OpInterface $op) : int
Parameters
- $op : OpInterface
Tags
Return values
intgetValidationReturn()
public
getValidationReturn(string $error, array<string|int, mixed> $validationData, OpInterface $op) : array<string|int, mixed>|array<string|int, array<string|int, ValidationErrorItem>>
Parameters
- $error : string
- $validationData : array<string|int, mixed>
- $op : OpInterface
Return values
array<string|int, mixed>|array<string|int, array<string|int, ValidationErrorItem>>handle()
This handler accepts two different approaches to update the language settings: Approach 1 (single language): - in this case the language needs to be part of the id array - patch structure: { "entity": "languageSetting", "op": "update", "id": "de", "props": { "title": "Beispielfragebogen" } }
public
handle(OpInterface $op) : void
Approach 2 (multiple languages):
- in this case the languages need to be indexes of the props array
- language must not be part of the id array
- patch structure: { "entity": "languageSetting", "op": "update", "id": null, "props": { "de": { "title": "Beispielfragebogen" }, "en": { "title": "Example Survey" } } }
Parameters
- $op : OpInterface
Tags
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>validateOperation()
Checks if patch is valid for this operation.
public
validateOperation(OpInterface $op) : array<string|int, mixed>
Parameters
- $op : OpInterface
Return values
array<string|int, mixed>throwNoValuesException()
private
throwNoValuesException(OpInterface $op[, string $name = '' ]) : void
Parameters
- $op : OpInterface
- $name : string = ''