mirror of
https://github.com/Codappix/search_core.git
synced 2024-12-22 11:56:14 +01:00
Merge remote-tracking branch 'origin/develop' into feature/147-handle-rendertype-inputDateTime
Conflicts: Tests/Unit/Domain/Index/TcaIndexer/RelationResolverTest.php
This commit is contained in:
commit
0d57374f25
13 changed files with 98 additions and 17 deletions
|
@ -37,7 +37,8 @@ class RelationResolver implements Singleton
|
|||
{
|
||||
foreach (array_keys($record) as $column) {
|
||||
// TODO: Define / configure fields to exclude?!
|
||||
if ($column === 'pid') {
|
||||
if (in_array($column, ['pid', $service->getLanguageUidColumn()])) {
|
||||
$record[$column] = (int) $record[$column];
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -283,6 +283,15 @@ class TcaTableService implements TcaTableServiceInterface
|
|||
return $this->tca['columns'][$columnName]['config'];
|
||||
}
|
||||
|
||||
public function getLanguageUidColumn() : string
|
||||
{
|
||||
if (!isset($this->tca['ctrl']['languageField'])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->tca['ctrl']['languageField'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given record was blacklisted by root line.
|
||||
* This can be configured by typoscript as whole root lines can be black listed.
|
||||
|
|
|
@ -290,6 +290,15 @@ class TcaTableService76 implements TcaTableServiceInterface
|
|||
return $this->tca['columns'][$columnName]['config'];
|
||||
}
|
||||
|
||||
public function getLanguageUidColumn() : string
|
||||
{
|
||||
if (!isset($this->tca['ctrl']['languageField'])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->tca['ctrl']['languageField'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given record was blacklisted by root line.
|
||||
* This can be configured by typoscript as whole root lines can be black listed.
|
||||
|
|
|
@ -41,4 +41,6 @@ interface TcaTableServiceInterface
|
|||
public function getRecords(int $offset, int $limit) : array;
|
||||
|
||||
public function getRecord(int $identifier) : array;
|
||||
|
||||
public function getLanguageUidColumn() : string;
|
||||
}
|
||||
|
|
|
@ -5,8 +5,9 @@ Changelog
|
|||
:maxdepth: 1
|
||||
:glob:
|
||||
|
||||
changelog/20180415-134-make-conent-fields-configurable
|
||||
changelog/20180409-25-provide-sys-language-uid
|
||||
changelog/20180408-131-respect-page-cache-clear
|
||||
changelog/20180408-introduce-php70-type-hints
|
||||
changelog/20180406-120-facet-configuration
|
||||
changelog/20180410-148-keep-sys_language_uid
|
||||
changelog/20180315-134-make-conent-fields-configurable
|
||||
changelog/20180309-25-provide-sys-language-uid
|
||||
changelog/20180308-131-respect-page-cache-clear
|
||||
changelog/20180308-introduce-php70-type-hints
|
||||
changelog/20180306-120-facet-configuration
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Breacking Change 120 "Pass facets configuration to Elasticsearch"
|
||||
=================================================================
|
||||
Breaking Change 120 "Pass facets configuration to Elasticsearch"
|
||||
================================================================
|
||||
|
||||
In order to allow arbitrary facet configuration, we do not process the facet configuration anymore.
|
||||
Instead integrators are able to configure facets for search service "as is". We just pipe the
|
|
@ -1,5 +1,5 @@
|
|||
Breacking Change "Introduce PHP 7.0 TypeHints"
|
||||
==============================================
|
||||
Breaking Change "Introduce PHP 7.0 TypeHints"
|
||||
=============================================
|
||||
|
||||
As PHP evolved, we now migrate the whole code base to use PHP 7.0 type hints.
|
||||
We do not use PHP 7.1 Type Hints, as some customers still need PHP 7.0 support.
|
|
@ -1,4 +1,4 @@
|
|||
FEATURE 25 "Respect multiple languages" - Provide sys_language_uid
|
||||
Feature 25 "Respect multiple languages" - Provide sys_language_uid
|
||||
==================================================================
|
||||
|
||||
Previously we did not fetch ``sys_language_uid`` field from database. This prevented everyone from
|
|
@ -1,4 +1,4 @@
|
|||
FEATURE 134 "Enable indexing of tt_content records of CType Header"
|
||||
Feature 134 "Enable indexing of tt_content records of CType Header"
|
||||
===================================================================
|
||||
|
||||
Before, only ``bodytext`` was used to generate content while indexing pages.
|
|
@ -0,0 +1,10 @@
|
|||
Feature 148 "Cast sys_language_uid to int"
|
||||
==========================================
|
||||
|
||||
While resolving relations the configured language uid field, fetched from TCA, will
|
||||
be casted to integer and returned immediately.
|
||||
|
||||
This change prevents the bug mentioned in :issue:`148`, where `0` is casted to an
|
||||
empty string, which makes filtering hard.
|
||||
|
||||
See :issue:`148`.
|
|
@ -103,11 +103,7 @@ class TcaIndexerTest extends AbstractFunctionalTestCase
|
|||
->with(
|
||||
$this->stringContains('tt_content'),
|
||||
$this->callback(function ($documents) {
|
||||
if ($this->isLegacyVersion()) {
|
||||
return isset($documents[0]['sys_language_uid']) && $documents[0]['sys_language_uid'] === '2';
|
||||
} else {
|
||||
return isset($documents[0]['sys_language_uid']) && $documents[0]['sys_language_uid'] === 2;
|
||||
}
|
||||
return isset($documents[0]['sys_language_uid']) && $documents[0]['sys_language_uid'] === 2;
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
@ -37,6 +37,59 @@ class RelationResolverTest extends AbstractUnitTestCase
|
|||
$this->subject = new RelationResolver();
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function sysLanguageUidZeroIsKept()
|
||||
{
|
||||
$record = [
|
||||
'sys_language_uid' => '0',
|
||||
];
|
||||
$GLOBALS['TCA'] = [
|
||||
'tt_content' => [
|
||||
'columns' => [
|
||||
'sys_language_uid' => [
|
||||
'config' => [
|
||||
'default' => 0,
|
||||
'items' => [
|
||||
[
|
||||
'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages',
|
||||
'-1',
|
||||
'flags-multiple',
|
||||
],
|
||||
],
|
||||
'renderType' => 'selectSingle',
|
||||
'special' => 'languages',
|
||||
'type' => 'select',
|
||||
'exclude' => '1',
|
||||
'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.language',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
$tableServiceMock = $this->getMockBuilder(TcaTableServiceInterface::class)->getMock();
|
||||
$tableServiceMock->expects($this->any())
|
||||
->method('getTableName')
|
||||
->willReturn('tt_content');
|
||||
$tableServiceMock->expects($this->any())
|
||||
->method('getLanguageUidColumn')
|
||||
->willReturn('sys_language_uid');
|
||||
$tableServiceMock->expects($this->any())
|
||||
->method('getColumnConfig')
|
||||
->willReturn($GLOBALS['TCA']['tt_content']['columns']['sys_language_uid']['config']);
|
||||
|
||||
$this->subject->resolveRelationsForRecord($tableServiceMock, $record);
|
||||
|
||||
$this->assertSame(
|
||||
[
|
||||
'sys_language_uid' => 0,
|
||||
],
|
||||
$record,
|
||||
'sys_language_uid was not kept as zero.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue