UserId = $row->user_id; $rowToReturn->FormattedSequence = $row->formatted_sequence; $rowToReturn->Sequence = $row->sequence; $rowToReturn->UnixDate = \strtotime($row->date); $rowToReturn->Data = $row->data; $rowToReturn->Total = \floatval($row->total); $rowToReturn->Quantity = Sanitizer::GetNumberValueFromPath($row, ['quantity']); $rowToReturn->Status = $row->status; $rowToReturn->EntryId = $row->entry_id; $rowToReturn->FormId = $row->form_id; $rowToReturn->UserName = ''; $rowToReturn->UserEmail = ''; $rowToReturn->ReferenceId = $row->reference_id; $userInfo = $this->UserIntegration->GetUserInfoById($rowToReturn->UserId); if($userInfo != null) { $rowToReturn->UserName = $userInfo->Name; $rowToReturn->UserEmail = $userInfo->Email; } if($row->meta_values != null) { $metaValues = \json_decode($row->meta_values); foreach($metaValues as $currentMeta) { $meta = new AIOMeta(); $meta->Load($currentMeta); $rowToReturn->Meta[] = $meta; } } foreach($row as $key => $value) { $matches = []; if(preg_match('/formula_(\d+)/', $key, $matches) == 1){ $formulaId = $matches[1]; $formula = $this->QueryManager->GetFormulaById($formulaId); $formId = $formula->FormToUse; $fieldId = $formula->FieldToUse; $formulaData = (Object) [ 'Value' => $value, 'FormId' => $formId, 'FieldId' => $fieldId ]; $rowToReturn->AdditionalValues[$key] = $formulaData; } } return $rowToReturn; } }