Skip to content

Commit

Permalink
[TASK] Avoid excessive whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
nhovratov committed Mar 9, 2024
1 parent 9c79850 commit 0a10fe5
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions Classes/DataProcessing/RelationResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,35 +82,28 @@ public function processField(
): mixed {
$fieldType = $tcaFieldDefinition->getFieldType();
$recordIdentifier = $tcaFieldDefinition->getUniqueIdentifier();

if (!array_key_exists($recordIdentifier, $record)) {
throw new \RuntimeException(
'The field "' . $recordIdentifier . '" is missing in the "' . $table
. '" table. Probably a database schema update is needed.',
1674222293
);
}

$data = $record[$recordIdentifier];

if ($fieldType === FieldType::FILE) {
$fileCollector = GeneralUtility::makeInstance(FileCollector::class);
$fileCollector->addFilesFromRelation($table, $recordIdentifier, $record);
return $fileCollector->getFiles();
}

if ($fieldType === FieldType::COLLECTION) {
return $this->processCollection($table, $record, $tcaFieldDefinition, $typeDefinition);
}

if ($fieldType === FieldType::CATEGORY) {
return $this->processCategory($tcaFieldDefinition, $typeDefinition, $table, $record);
}

if ($fieldType === FieldType::RELATION) {
return $this->processRelation($tcaFieldDefinition, $typeDefinition, $table, $record);
}

if ($fieldType === FieldType::FOLDER) {
$fileCollector = GeneralUtility::makeInstance(FileCollector::class);
$folders = GeneralUtility::trimExplode(',', (string)$data, true);
Expand All @@ -119,22 +112,18 @@ public function processField(
$fileCollector->addFilesFromFolders($folders, $folderFieldConfiguration->isRecursive());
return $fileCollector->getFiles();
}

if ($fieldType === FieldType::SELECT) {
return $this->processSelect($tcaFieldDefinition, $typeDefinition, $table, $record);
}

if ($fieldType === FieldType::FLEXFORM) {
return $this->flexFormService->convertFlexFormContentToArray($data);
}

if ($fieldType === FieldType::JSON) {
$platform = GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable($table)
->getDatabasePlatform();
return Type::getType('json')->convertToPHPValue($data, $platform);
}

return $data;
}

Expand Down

0 comments on commit 0a10fe5

Please sign in to comment.