Skip to content

Commit

Permalink
allow null values for index fields
Browse files Browse the repository at this point in the history
  • Loading branch information
benwalch committed Nov 20, 2024
1 parent 9263f3d commit 5b13134
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/Generator/IndexDocumentGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@ protected function populateIndexDocument(
$dataTransformerOptions = $documentDefinitionOptions['data_transformer'];
$transformedData = $this->dispatchResourceFieldTransformer($dataTransformerOptions, $resourceScaffolderName, $resourceContainer);

if ($transformedData === null) {
// no error: transformer is allowed to refuse data
continue;
}

$optionFieldContainer = new OptionFieldContainer($fieldName, $transformedData);
$indexDocument->addOptionField($optionFieldContainer);
}
Expand Down Expand Up @@ -133,11 +128,6 @@ protected function processDocumentDataTransformerField(

$transformedData = $this->dispatchResourceFieldTransformer($dataTransformerOptions, $resourceScaffolderName, $resourceContainer);

if ($transformedData === null) {
// no error: transformer is allowed to refuse data
return;
}

if ($fieldType === 'pre_process_definition') {

$documentDefinition->setCurrentLevel($fieldDefinitionOptions['level']);
Expand Down Expand Up @@ -202,6 +192,10 @@ protected function dispatchResourceFieldTransformer(array $options, string $disp
sprintf('Error while transform field resource with service "%s": %s', $fieldTransformerName, $e->getMessage()));
}

if ($transformedData === '') {
return null;
}

return $transformedData;
}

Expand All @@ -226,10 +220,6 @@ protected function dispatchIndexTransformer(ContextDefinitionInterface $contextD
);
}

if ($indexFieldData === null) {
return null;
}

return $indexFieldData;
}

Expand Down

0 comments on commit 5b13134

Please sign in to comment.