DbStorage

Implements \LimeSurvey\PluginManager\iPluginStorage

package

Default

Methods

Constructor must not take argument.

__construct() 

The constructor must be part of the interface since our Plugin factory calls it and thus must know its arguments.

Returns plugin data.

get(\LimeSurvey\PluginManager\iPlugin $plugin, string $key = null, string $model = null, integer $id = null, mixed $default = null, string $language = null) : mixed

Arguments

$plugin

\LimeSurvey\PluginManager\iPlugin

The plugin object getting its data.

$key

string

Key for the setting; passing null will return all keys.

$model

string

Optional model name to which the data was attached.

$id

integer

Optional id of the model instance to which the data was attached.

$default

mixed

Default value to return if key could not be found.

$language

string

Optional language identifier used for retrieving the setting.

Response

mixed

Returns the value from the database or null if not set.

getGeneric

getGeneric(\LimeSurvey\PluginManager\iPlugin $plugin, string $key, string $model, integer $id, mixed $default) : mixed

Arguments

$key

string

$model

string

Optional model name to which the data was attached.

$id

integer

Optional id of the model instance to which the data was attached.

$default

mixed

Default value to return if key could not be found.

Response

mixed

Returns the value from the database or null if not set.

This function retrieves plugin data related to the Question model.

getQuestion(\LimeSurvey\PluginManager\iPlugin $plugin, \LimeSurvey\PluginManager\type $key, \LimeSurvey\PluginManager\type $model, \LimeSurvey\PluginManager\type $id, \LimeSurvey\PluginManager\type $default, \LimeSurvey\PluginManager\type $language) 

LS saves this data in a question_attributes EAV table; therefore the 'Question' model is treated specially.

Arguments

$key

\LimeSurvey\PluginManager\type

$model

\LimeSurvey\PluginManager\type

$id

\LimeSurvey\PluginManager\type

$default

\LimeSurvey\PluginManager\type

$language

\LimeSurvey\PluginManager\type

Gets a field from the question table.

getQuestionBase(integer $questionId, string $key, mixed $default) 

Arguments

$questionId

integer

$key

string

$default

mixed

Default value in case key could not be found.

Stores plugin data.

set(\LimeSurvey\PluginManager\iPlugin $plugin, string $key, mixed $data, string $model = null, integer $id = null, string $language = null) : boolean

Arguments

$plugin

\LimeSurvey\PluginManager\iPlugin

The plugin object getting its data.

$key

string

The storage key to identify the data.

$data

mixed

The data to be stored, serialized using serialize.

$model

string

Optional model name to which the data was attached.

$id

integer

Optional id of the model instance to which the data was attached.

$language

string

Optional language identifier used for storing the setting.

Response

boolean

setGeneric

setGeneric(\LimeSurvey\PluginManager\iPlugin $plugin, string $key,  $data, string $model, integer $id, string $language) : boolean

Arguments

$key

string

$data

$model

string

Optional model name to which the data was attached.

$id

integer

Optional id of the model instance to which the data was attached.

$language

string

Optional language identifier used for storing the setting.

Response

boolean

setQuestion

setQuestion(\LimeSurvey\PluginManager\iPlugin $plugin, string $key,  $data, string $model, integer $id, string $language) : boolean

Arguments

$key

string

$data

$model

string

Optional model name to which the data was attached.

$id

integer

Optional id of the model instance to which the data was attached.

$language

string

Optional language identifier used for storing the setting.

Response

boolean

Sets a field from the question table.

setQuestionBase(integer $questionId, string $key, mixed $data) 

Arguments

$questionId

integer

$key

string

$data

mixed

Data to be saved.