diff --git a/src/Generator/IndexDocumentGenerator.php b/src/Generator/IndexDocumentGenerator.php index d09a59f..43ba9ec 100644 --- a/src/Generator/IndexDocumentGenerator.php +++ b/src/Generator/IndexDocumentGenerator.php @@ -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); } @@ -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']); @@ -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; } @@ -226,10 +220,6 @@ protected function dispatchIndexTransformer(ContextDefinitionInterface $contextD ); } - if ($indexFieldData === null) { - return null; - } - return $indexFieldData; }