protected function precalculateExportRecord(AbstractRecord $record, DataDimensions $dataDimensions) { $key = 'exportrecord-' . $record->getDataType() . '-' . $record->getDataTypeName() . '-' . $dataDimensions->getViewName(); if (array_key_exists($key, $this->precalculations)) { $precalculate = $this->precalculations[$key]; } else { $definition = $record->getDataTypeDefinition(); $allowedProperties = $definition->getProperties($dataDimensions->getViewName()); $allowedProperties = array_combine($allowedProperties, $allowedProperties); $precalculate = []; $precalculate['allowedProperties'] = $allowedProperties; $this->precalculations[$key] = $precalculate; } return $precalculate; }
/** * * @param $record * @param $jsonRecord * * @return mixed * @throws AnyContentClientException */ protected function finishRecordCreationFromJSON(AbstractRecord $record, $jsonRecord) { $revision = isset($jsonRecord['info']['revision']) ? $jsonRecord['info']['revision'] : 1; $record->setRevision($revision); if ($this->getOption('validateProperties') == true) { foreach ($jsonRecord['properties'] as $property => $value) { $record->setProperty($property, $value); } } else { $record->setProperties($jsonRecord['properties']); } if (isset($jsonRecord['info'])) { if (isset($jsonRecord['info']['creation'])) { $record->setCreationUserInfo(new UserInfo($jsonRecord['info']['creation']['username'], $jsonRecord['info']['creation']['firstname'], $jsonRecord['info']['creation']['lastname'], $jsonRecord['info']['creation']['timestamp'])); } if (isset($jsonRecord['info']['lastchange'])) { $record->setLastChangeUserInfo(new UserInfo($jsonRecord['info']['lastchange']['username'], $jsonRecord['info']['lastchange']['firstname'], $jsonRecord['info']['lastchange']['lastname'], $jsonRecord['info']['lastchange']['timestamp'])); } } return $record; }