protected function getMultiViewConfig($configTypeName, DataDimensions $dataDimensions) { $tableName = $this->getConfigTypeTableName(); $database = $this->getDatabase(); $timestamp = TimeShifter::getTimeshiftTimestamp($dataDimensions->getTimeShift()); $sql = 'SELECT * FROM ' . $tableName . ' WHERE id = ? AND workspace = ? AND language = ? AND validfrom_timestamp <= ? AND validuntil_timestamp > ?'; $rows = $database->fetchAllSQL($sql, [$configTypeName, $dataDimensions->getWorkspace(), $dataDimensions->getLanguage(), $timestamp, $timestamp]); if (count($rows) == 1) { $row = reset($rows); $config = $this->createConfigFromRow($row, $configTypeName, $dataDimensions); } else { $definition = $this->getConfigTypeDefinition($configTypeName); $config = $this->getRecordFactory()->createConfig($definition); KVMLogger::instance('anycontent-connection')->info('Config ' . $configTypeName . ' not found'); } return $config; }
protected function requestRecords($contentTypeName, DataDimensions $dataDimensions, $filter, $page = 1, $count = null, $order = ['.id']) { $url = 'content/' . $contentTypeName . '/records/' . $dataDimensions->getWorkspace() . '/' . $dataDimensions->getViewName() . '?language=' . $dataDimensions->getLanguage() . '&view=' . $dataDimensions->getViewName() . '×hift=' . $dataDimensions->getTimeShift(); if ($count != null) { $url .= '&page=' . $page . '&limit=' . $count; } if ($filter) { // V1 compatibility $filter = str_replace('*=', '><', (string) $filter); $url .= '&filter=' . urlencode($filter); } // V1 compatibility - multi sort is not possible $map = ['.id' => 'id', '.id-' => 'id', 'position' => 'pos', 'position-' => 'pos-', '.info.creation.timestamp' => 'creation', '.info.creation.timestamp-' => 'creation-', '.info.lastchange.timestamp' => 'change', '.info.lastchange.timestamp-' => 'change-']; if (is_array($order)) { $order = reset($order); if (array_key_exists($order, $map)) { $order = $map[$order]; } } $url .= '&order=' . $order; $response = $this->getClient()->get($url); $json = $response->json(); $records = $this->getRecordFactory()->createRecordsFromJSONRecordsArray($this->getContentTypeDefinition($contentTypeName), $json['records']); return $records; }