/** * Store in the table all value corresponding to a key * @param \taoResultServer_models_classes_Variable $variable */ private function storeKeysValues($variableId, \taoResultServer_models_classes_Variable $variable) { $basetype = $variable->getBaseType(); foreach (array_keys((array) $variable) as $key) { $getter = 'get' . ucfirst($key); $value = null; if (method_exists($variable, $getter)) { $value = $variable->{$getter}(); if ($key == 'value' || $key == 'candidateResponse') { $value = base64_encode($value); } } if ($key == 'epoch' && !$variable->isSetEpoch()) { $value = microtime(); } $this->persistence->insert(self::RESULT_KEY_VALUE_TABLE_NAME, array(self::RESULTSKV_FK_COLUMN => $variableId, self::KEY_COLUMN => $key, self::VALUE_COLUMN => $value)); } }