Merge branch 'feature/small-improvements' into feature/cms-8-support

This commit is contained in:
Daniel Siepmann 2017-08-04 13:40:53 +02:00
commit 0fa05270d5
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
2 changed files with 10 additions and 36 deletions

View file

@ -61,7 +61,10 @@ class DocumentFactory implements Singleton
$identifier = $document['search_identifier'];
unset($document['search_identifier']);
$this->logger->debug('Convert document to document', [$identifier, $document]);
$this->logger->debug(
sprintf('Convert %s %u to document.', $documentType, $identifier),
[$identifier, $document]
);
return new \Elastica\Document($identifier, $document);
}

View file

@ -23,10 +23,6 @@ namespace Codappix\SearchCore\Domain\Index\TcaIndexer;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\SingletonInterface as Singleton;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Backend\Form\FormDataCompiler;
use TYPO3\CMS\Backend\Form\FormDataGroup\TcaDatabaseRecord;
/**
* Resolves relations from TCA using TCA.
@ -36,12 +32,6 @@ use TYPO3\CMS\Backend\Form\FormDataGroup\TcaDatabaseRecord;
*/
class RelationResolver implements Singleton
{
/**
* Resolve relations for the given record.
*
* @param TcaTableService $service
* @param array $record
*/
public function resolveRelationsForRecord(TcaTableService $service, array &$record) : void
{
foreach (array_keys($record) as $column) {
@ -59,38 +49,27 @@ class RelationResolver implements Singleton
}
} catch (InvalidArgumentException $e) {
// Column is not configured.
continue;
}
}
}
/**
* Resolve the given value from TYPO3 API response.
*
* @param mixed $value The value from FormEngine to resolve.
* @param array $tcaColumn The tca config of the relation.
*
* @return array<String>|string
*/
protected function resolveValue($value, array $tcaColumn)
{
if ($value === '') {
return '';
if ($value === '' || $value === 'N/A') {
return [];
}
if ($tcaColumn['type'] === 'select') {
if ($tcaColumn['type'] === 'select' && strpos($value, ';') !== false) {
return $this->resolveForeignDbValue($value);
}
if ($tcaColumn['type'] === 'inline' || $tcaColumn['type'] === 'group') {
if (in_array($tcaColumn['type'], ['inline', 'group', 'select'])) {
return $this->resolveInlineValue($value);
}
return '';
return [];
}
/**
* @param array Column config.
* @return bool
*/
protected function isRelation(array &$config) : bool
{
return isset($config['foreign_table'])
@ -99,16 +78,8 @@ class RelationResolver implements Singleton
;
}
/**
* @param string $value
*
* @return array
*/
protected function resolveForeignDbValue(string $value) : array
{
if ($value === 'N/A') {
return [];
}
return array_map('trim', explode(';', $value));
}