mirror of
https://github.com/Codappix/search_core.git
synced 2024-12-26 01:56:10 +01:00
TASK: Cleanup code
Use get and use an try catch. Receiving null through ifExists will result in an php error.
This commit is contained in:
parent
7722c37ea5
commit
334bb34625
1 changed files with 16 additions and 11 deletions
|
@ -21,6 +21,7 @@ namespace Codappix\SearchCore\Domain\Index;
|
|||
*/
|
||||
|
||||
use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
|
||||
use Codappix\SearchCore\Configuration\InvalidArgumentException;
|
||||
use Codappix\SearchCore\Connection\ConnectionInterface;
|
||||
use \TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
|
@ -125,18 +126,22 @@ abstract class AbstractIndexer implements IndexerInterface
|
|||
{
|
||||
$record['search_abstract'] = '';
|
||||
|
||||
$fieldsToUse = GeneralUtility::trimExplode(
|
||||
',',
|
||||
$this->configuration->getIfExists('indexing.' . $this->identifier . '.abstractFields')
|
||||
);
|
||||
if (!$fieldsToUse) {
|
||||
return;
|
||||
}
|
||||
foreach ($fieldsToUse as $fieldToUse) {
|
||||
if (isset($record[$fieldToUse]) && trim($record[$fieldToUse])) {
|
||||
$record['search_abstract'] = trim($record[$fieldToUse]);
|
||||
break;
|
||||
try {
|
||||
$fieldsToUse = GeneralUtility::trimExplode(
|
||||
',',
|
||||
$this->configuration->get('indexing.' . $this->identifier . '.abstractFields')
|
||||
);
|
||||
if (!$fieldsToUse) {
|
||||
return;
|
||||
}
|
||||
foreach ($fieldsToUse as $fieldToUse) {
|
||||
if (isset($record[$fieldToUse]) && trim($record[$fieldToUse])) {
|
||||
$record['search_abstract'] = trim($record[$fieldToUse]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (InvalidArgumentException $e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue