Entity
in package
uses
SessionTrait, JsonTrait
This is a class holding common functionality to be extended by various other classes.
Entity provides base functionality for classes that represent database entities. Extending classes must define:
- protected $TABLE_NAME - The database table name
- protected $PRIMARY_KEY - The primary key column name
- public $id - The entity's ID value
Table of Contents
Properties
- $launch : mixed
- A reference to our containing launch
Methods
- getJson() : string
- Load the json field for this entity
- getJsonKey() : mixed
- Get a JSON key for this entity
- getJsonKeyLegacy() : mixed
- Get a JSON key for this entity (legacy array style)
- ltiCustomGet() : mixed
- Pull out a custom variable from the LTIX session. Do not include the "custom_" prefix - this is automatic.
- ltiParameter() : mixed
- Pull a keyed variable from the original LTI post data in the current session with default
- ltiParameterUpdate() : mixed
- Update a keyed variable from the original LTI post data in the current session with default
- ltiRawParameter() : mixed
- Pull a keyed variable from the original LTI post data in the current session with default
- ltiRawPostArray() : mixed
- Return the original $_POST array
- setJson() : mixed
- Set the JSON entry for this entity
- setJsonKey() : mixed
- Set/update a JSON key for this entity
- setJsonKeys() : mixed
- Set/update an array of JSON keys for this entity
Properties
$launch
A reference to our containing launch
public
mixed
$launch
Methods
getJson()
Load the json field for this entity
public
getJson() : string
Return values
string —This returns the json string - it is not parsed - if there is nothing to return - this returns "false"
getJsonKey()
Get a JSON key for this entity
public
getJsonKey(mixed $key[, mixed $default = false ]) : mixed
Parameters
- $key : mixed
-
The key to be retrieved from the JSON
- $default : mixed = false
-
The default value (optional)
getJsonKeyLegacy()
Get a JSON key for this entity (legacy array style)
public
getJsonKeyLegacy(mixed $key[, mixed $default = false ]) : mixed
Parameters
- $key : mixed
-
The key to be retrieved from the JSON
- $default : mixed = false
-
The default value (optional)
ltiCustomGet()
Pull out a custom variable from the LTIX session. Do not include the "custom_" prefix - this is automatic.
public
ltiCustomGet(mixed $varname[, mixed $default = false ]) : mixed
Parameters
- $varname : mixed
- $default : mixed = false
ltiParameter()
Pull a keyed variable from the original LTI post data in the current session with default
public
ltiParameter(mixed $varname[, mixed $default = false ]) : mixed
Parameters
- $varname : mixed
- $default : mixed = false
ltiParameterUpdate()
Update a keyed variable from the original LTI post data in the current session with default
public
ltiParameterUpdate(mixed $varname, mixed $value) : mixed
Parameters
- $varname : mixed
- $value : mixed
ltiRawParameter()
Pull a keyed variable from the original LTI post data in the current session with default
public
ltiRawParameter(mixed $varname[, mixed $default = false ]) : mixed
Parameters
- $varname : mixed
- $default : mixed = false
ltiRawPostArray()
Return the original $_POST array
public
ltiRawPostArray() : mixed
setJson()
Set the JSON entry for this entity
public
setJson(mixed $json) : mixed
Parameters
- $json : mixed
-
This is a string - no validation is done
setJsonKey()
Set/update a JSON key for this entity
public
setJsonKey(mixed $key, mixed $value) : mixed
Parameters
- $key : mixed
-
The key to be inserted/updated in the JSON
- $value : mixed
-
The value to be inserted/updated in the JSON
setJsonKeys()
Set/update an array of JSON keys for this entity
public
setJsonKeys(mixed $values) : mixed
Parameters
- $values : mixed
-
An array of key/value pairs to be inserted/updated in the JSON