3declare(strict_types=1);
58 $query =
'SELECT * FROM lti_consumer_results'
59 .
' WHERE id = ' .
$DIC->database()->quote($a_id,
'integer');
62 if ($row =
$DIC->database()->fetchAssoc(
$res)) {
64 $resObj->fillData($row);
79 $query =
'SELECT * FROM lti_consumer_results'
80 .
' WHERE obj_id = ' .
$DIC->database()->quote($a_obj_id,
'integer')
81 .
' AND usr_id = ' .
$DIC->database()->quote($a_usr_id,
'integer');
84 if ($row =
$DIC->database()->fetchAssoc(
$res)) {
86 $resObj->fillData($row);
88 } elseif ($a_create) {
90 $resObj->obj_id = $a_obj_id;
91 $resObj->usr_id = $a_usr_id;
92 $resObj->result =
null;
106 $this->
id = (
int) $data[
'id'];
107 $this->obj_id = (
int)
$data[
'obj_id'];
108 $this->usr_id = (
int)
$data[
'usr_id'];
109 $this->result = (float)
$data[
'result'];
119 if (!isset($this->usr_id) || !isset($this->obj_id)) {
122 if (!isset($this->
id)) {
123 $this->
id = $DIC->database()->nextId(
'lti_consumer_results');
125 $DIC->database()->replace(
126 'lti_consumer_results',
128 'id' => array(
'integer', $this->
id)
131 'obj_id' => array(
'integer', $this->obj_id),
132 'usr_id' => array(
'integer', $this->usr_id),
133 'result' => array(
'float', $this->result)
167 $query =
'SELECT * FROM lti_consumer_results'
168 .
' WHERE obj_id = ' .
$DIC->database()->quote(
$objId,
'integer');
174 if ($row =
$DIC->database()->fetchAssoc(
$res)) {
176 $resObj->fillData($row);
178 $results[$resObj->getUsrId()] = $resObj;
static getResultsForObject(int $objId)
static getByKeys(int $a_obj_id, int $a_usr_id, ?bool $a_create=false)
Get a result by object and user key.
save()
Save a result object.
fillData(array $data)
Fill the properties with data from an array.
static getById(int $a_id)
Get a result by id.