BUGFIX: Also remove fields containing "null"

This commit is contained in:
Daniel Siepmann 2017-11-08 20:36:04 +01:00
parent 0159315183
commit 379dddf8ac
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
2 changed files with 12 additions and 1 deletions

View file

@ -34,7 +34,7 @@ class RemoveProcessor implements ProcessorInterface
} }
foreach (GeneralUtility::trimExplode(',', $configuration['fields'], true) as $field) { foreach (GeneralUtility::trimExplode(',', $configuration['fields'], true) as $field) {
if (isset($record[$field])) { if (array_key_exists($field, $record)) {
unset($record[$field]); unset($record[$field]);
} }
} }

View file

@ -117,6 +117,17 @@ class RemoveProcessorTest extends AbstractUnitTestCase
'field 1' => 'Some content like lorem', 'field 1' => 'Some content like lorem',
], ],
], ],
'Fields with "null" san be removed' => [
'record' => [
'field 1' => null,
],
'configuration' => [
'fields' => 'field 1',
'_typoScriptNodeValue' => 'Codappix\SearchCore\DataProcessing\RemoveProcessor',
],
'expectedRecord' => [
],
],
]; ];
} }
} }