From 9769ee1cb68b465c5a845d79bb3a185185aa9aef Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 3 Jul 2017 22:59:18 +0200 Subject: [PATCH 01/16] TASK: Update composer Require TYPO3 CMS 8.2 and PHP 7.1 as minimum. Use conventionally lower case web folder. --- composer.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index debb71f..2aba101 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,8 @@ } }, "require" : { - "php": ">=5.6.0", - "typo3/cms": "~7.6", + "php": ">=7.1.0", + "typo3/cms": "~8.2", "ruflin/elastica": "~3.2" }, "require-dev": { @@ -30,14 +30,14 @@ }, "scripts": { "post-autoload-dump": [ - "mkdir -p .Build/Web/typo3conf/ext/", - "[ -L .Build/Web/typo3conf/ext/search_core ] || ln -snvf ../../../../. .Build/Web/typo3conf/ext/search_core" + "mkdir -p .Build/web/typo3conf/ext/", + "[ -L .Build/web/typo3conf/ext/search_core ] || ln -snvf ../../../../. .Build/web/typo3conf/ext/search_core" ] }, "extra": { "typo3/cms": { "cms-package-dir": "{$vendor-dir}/typo3/cms", - "web-dir": ".Build/Web" + "web-dir": ".Build/web" } }, "authors": [ From 9d20524706053368ff9c0e82fc839cbbbb4cd16a Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 4 Jul 2017 10:12:47 +0200 Subject: [PATCH 02/16] WIP|TASK: Use new TYPO3 Use testing framework configuration. Use new db. Begin with replacement of old TYPO3_DB. --- Classes/Domain/Index/TcaIndexer.php | 10 ++++++++-- Makefile | 8 +++++--- Tests/Functional/FunctionalTests.xml | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Classes/Domain/Index/TcaIndexer.php b/Classes/Domain/Index/TcaIndexer.php index b50c6fa..3abdcb3 100644 --- a/Classes/Domain/Index/TcaIndexer.php +++ b/Classes/Domain/Index/TcaIndexer.php @@ -112,7 +112,7 @@ class TcaIndexer implements IndexerInterface */ protected function getRecords($offset, $limit) { - $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( + $records = $this->getDatabaseConnection()->exec_SELECTgetRows( $this->tcaTableService->getFields(), $this->tcaTableService->getTableClause(), $this->tcaTableService->getWhereClause(), @@ -139,7 +139,7 @@ class TcaIndexer implements IndexerInterface */ protected function getRecord($identifier) { - $record = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow( + $record = $this->getDatabaseConnection()->exec_SELECTgetSingleRow( $this->tcaTableService->getFields(), $this->tcaTableService->getTableClause(), $this->tcaTableService->getWhereClause() @@ -156,4 +156,10 @@ class TcaIndexer implements IndexerInterface return $record; } + + protected function getDatabaseConnection() + { + return GeneralUtility::makeInstance(ConnectionPool::class) + ->getConnectionByName('Default'); + } } diff --git a/Makefile b/Makefile index 589dd7d..566709a 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,11 @@ mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) current_dir := $(dir $(mkfile_path)) -TYPO3_WEB_DIR := $(current_dir).Build/Web +TYPO3_WEB_DIR := $(current_dir).Build/web +TYPO3_PATH_ROOT := $(current_dir).Build/web # Allow different versions on travis -TYPO3_VERSION ?= ~7.6 -typo3DatabaseName ?= "searchcore_test" +TYPO3_VERSION ?= ~8.2 +typo3DatabaseName ?= "searchcore_test2" typo3DatabaseUsername ?= "dev" typo3DatabasePassword ?= "dev" typo3DatabaseHost ?= "127.0.0.1" @@ -21,6 +22,7 @@ functionalTests: typo3DatabaseHost=$(typo3DatabaseHost) \ TYPO3_PATH_WEB=$(TYPO3_WEB_DIR) \ .Build/bin/phpunit --colors --debug -v \ + --stop-on-error \ -c Tests/Functional/FunctionalTests.xml uploadCodeCoverage: uploadCodeCoverageToScrutinizer uploadCodeCoverageToCodacy diff --git a/Tests/Functional/FunctionalTests.xml b/Tests/Functional/FunctionalTests.xml index d42ef21..a318f65 100644 --- a/Tests/Functional/FunctionalTests.xml +++ b/Tests/Functional/FunctionalTests.xml @@ -1,7 +1,7 @@ Date: Fri, 7 Jul 2017 12:03:06 +0200 Subject: [PATCH 03/16] TASK: Migrate dev dependencies As testing framework is used, we can prefer dist again to speed up composer installation. --- Makefile | 4 ++-- Tests/Unit/UnitTests.xml | 2 +- composer.json | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index e8177b9..87bcdfc 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ current_dir := $(dir $(mkfile_path)) TYPO3_WEB_DIR := $(current_dir).Build/web TYPO3_PATH_ROOT := $(current_dir).Build/web # Allow different versions on travis -TYPO3_VERSION ?= ~8.2 +TYPO3_VERSION ?= ~8.7 typo3DatabaseName ?= "searchcore_test2" typo3DatabaseUsername ?= "dev" typo3DatabasePassword ?= "dev" @@ -12,7 +12,7 @@ typo3DatabaseHost ?= "127.0.0.1" .PHONY: install install: clean - COMPOSER_PROCESS_TIMEOUT=1000 composer require -vv --dev --prefer-source --ignore-platform-reqs typo3/cms="$(TYPO3_VERSION)" + COMPOSER_PROCESS_TIMEOUT=1000 composer require -vv --dev --prefer-dist --ignore-platform-reqs typo3/cms="$(TYPO3_VERSION)" git checkout composer.json functionalTests: diff --git a/Tests/Unit/UnitTests.xml b/Tests/Unit/UnitTests.xml index 6456405..6486594 100644 --- a/Tests/Unit/UnitTests.xml +++ b/Tests/Unit/UnitTests.xml @@ -1,7 +1,7 @@ Date: Fri, 7 Jul 2017 12:19:35 +0200 Subject: [PATCH 04/16] BUGFIX: Allow tests to run without database connection Ad TYPO3 Core now makes use of Doctrine, a connection is required to build system where. Therefore we move it to an own method to exchange the execution inside of tests. --- .../Index/TcaIndexer/TcaTableService.php | 26 ++++++++++++------- .../Index/TcaIndexer/TcaTableServiceTest.php | 6 +++++ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Classes/Domain/Index/TcaIndexer/TcaTableService.php b/Classes/Domain/Index/TcaIndexer/TcaTableService.php index 21e6374..65adf70 100644 --- a/Classes/Domain/Index/TcaIndexer/TcaTableService.php +++ b/Classes/Domain/Index/TcaIndexer/TcaTableService.php @@ -142,15 +142,7 @@ class TcaTableService */ public function getWhereClause() { - $whereClause = '1=1' - . BackendUtility::BEenableFields($this->tableName) - . BackendUtility::deleteClause($this->tableName) - - . BackendUtility::BEenableFields('pages') - . BackendUtility::deleteClause('pages') - . ' AND pages.no_search = 0' - ; - + $whereClause = $this->getSystemWhereClause(); $userDefinedWhere = $this->configuration->getIfExists('indexing.' . $this->getTableName() . '.additionalWhereClause'); if (is_string($userDefinedWhere)) { $whereClause .= ' AND ' . $userDefinedWhere; @@ -169,6 +161,22 @@ class TcaTableService return $whereClause; } + /** + * Generate SQL for TYPO3 as a system, to make sure only available records + * are fetched. + */ + public function getSystemWhereClause() : string + { + return '1=1' + . BackendUtility::BEenableFields($this->tableName) + . BackendUtility::deleteClause($this->tableName) + + . BackendUtility::BEenableFields('pages') + . BackendUtility::deleteClause('pages') + . ' AND pages.no_search = 0' + ; + } + /** * @return string */ diff --git a/Tests/Unit/Domain/Index/TcaIndexer/TcaTableServiceTest.php b/Tests/Unit/Domain/Index/TcaIndexer/TcaTableServiceTest.php index 9e88d4b..330c16e 100644 --- a/Tests/Unit/Domain/Index/TcaIndexer/TcaTableServiceTest.php +++ b/Tests/Unit/Domain/Index/TcaIndexer/TcaTableServiceTest.php @@ -60,6 +60,9 @@ class TcaTableServiceTest extends AbstractUnitTestCase ->method('getIfExists') ->withConsecutive(['indexing.table.additionalWhereClause'], ['indexing.table.rootLineBlacklist']) ->will($this->onConsecutiveCalls(null, false)); + $this->subject->expects($this->once()) + ->method('getSystemWhereClause') + ->will($this->returnValue('1=1 AND pages.no_search = 0')); $this->assertSame( '1=1 AND pages.no_search = 0', @@ -76,6 +79,9 @@ class TcaTableServiceTest extends AbstractUnitTestCase ->method('getIfExists') ->withConsecutive(['indexing.table.additionalWhereClause'], ['indexing.table.rootLineBlacklist']) ->will($this->onConsecutiveCalls('table.field = "someValue"', false)); + $this->subject->expects($this->once()) + ->method('getSystemWhereClause') + ->will($this->returnValue('1=1 AND pages.no_search = 0')); $this->assertSame( '1=1 AND pages.no_search = 0 AND table.field = "someValue"', From cf902dde83f64aac4a3326810012d38f69f5f622 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Fri, 7 Jul 2017 14:44:32 +0200 Subject: [PATCH 05/16] TASK: Make extension more compatible Migrate sql to doctrine. Migrate relation resolver to use new API. --- Classes/Database/Doctrine/Join.php | 50 ++++++++++ Classes/Database/Doctrine/Where.php | 53 +++++++++++ Classes/Domain/Index/TcaIndexer.php | 29 ++++-- .../Index/TcaIndexer/RelationResolver.php | 94 ++++--------------- .../Index/TcaIndexer/TcaTableService.php | 90 +++++++++--------- Makefile | 1 - .../Connection/Elasticsearch/FilterTest.php | 2 +- .../Elasticsearch/IndexTcaTableTest.php | 2 +- .../Index/TcaIndexer/TcaTableServiceTest.php | 14 ++- 9 files changed, 202 insertions(+), 133 deletions(-) create mode 100644 Classes/Database/Doctrine/Join.php create mode 100644 Classes/Database/Doctrine/Where.php diff --git a/Classes/Database/Doctrine/Join.php b/Classes/Database/Doctrine/Join.php new file mode 100644 index 0000000..df1a8c6 --- /dev/null +++ b/Classes/Database/Doctrine/Join.php @@ -0,0 +1,50 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +class Join +{ + /** + * @var string + */ + protected $table = ''; + + /** + * @var string + */ + protected $condition = ''; + + public function __construct(string $table, string $condition) + { + $this->table = $table; + $this->condition = $condition; + } + + public function getTable() : string + { + return $this->table; + } + + public function getCondition() : string + { + return $this->condition; + } +} diff --git a/Classes/Database/Doctrine/Where.php b/Classes/Database/Doctrine/Where.php new file mode 100644 index 0000000..3398991 --- /dev/null +++ b/Classes/Database/Doctrine/Where.php @@ -0,0 +1,53 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +/** + * + */ +class Where +{ + /** + * @var string + */ + protected $statement = ''; + + /** + * @var array + */ + protected $parameters = []; + + public function __construct(string $statement, array $parameters) + { + $this->statement = $statement; + $this->parameters = $parameters; + } + + public function getStatement() : string + { + return $this->statement; + } + + public function getParameters() : array + { + return $this->parameters; + } +} diff --git a/Classes/Domain/Index/TcaIndexer.php b/Classes/Domain/Index/TcaIndexer.php index c0a77a1..18444ce 100644 --- a/Classes/Domain/Index/TcaIndexer.php +++ b/Classes/Domain/Index/TcaIndexer.php @@ -21,6 +21,8 @@ namespace Codappix\SearchCore\Domain\Index; */ use Codappix\SearchCore\Connection\ConnectionInterface; +use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Utility\GeneralUtility; /** * Will index the given table using configuration from TCA. @@ -51,14 +53,22 @@ class TcaIndexer extends AbstractIndexer */ protected function getRecords($offset, $limit) { - $records = $this->getDatabaseConnection()->exec_SELECTgetRows( - $this->tcaTableService->getFields(), - $this->tcaTableService->getTableClause(), - $this->tcaTableService->getWhereClause(), - '', - '', - (int) $offset . ',' . (int) $limit - ); + $queryBuilder = $this->getDatabaseConnection()->getQueryBuilderForTable($this->tcaTableService->getTableName()); + $where = $this->tcaTableService->getWhereClause(); + $query = $queryBuilder->select(... $this->tcaTableService->getFields()) + ->from($this->tcaTableService->getTableClause()) + ->where($where->getStatement()) + ->setParameters($where->getParameters()) + ->setFirstResult($offset) + ->setMaxResults($limit); + + foreach ($this->tcaTableService->getJoins() as $join) { + $query->from($join->getTable()); + $query->andWhere($join->getCondition()); + } + + $records = $query->execute()->fetchAll(); + if ($records === null) { return null; } @@ -106,7 +116,6 @@ class TcaIndexer extends AbstractIndexer protected function getDatabaseConnection() { - return GeneralUtility::makeInstance(ConnectionPool::class) - ->getConnectionByName('Default'); + return GeneralUtility::makeInstance(ConnectionPool::class); } } diff --git a/Classes/Domain/Index/TcaIndexer/RelationResolver.php b/Classes/Domain/Index/TcaIndexer/RelationResolver.php index b09e483..93cfffb 100644 --- a/Classes/Domain/Index/TcaIndexer/RelationResolver.php +++ b/Classes/Domain/Index/TcaIndexer/RelationResolver.php @@ -42,38 +42,31 @@ class RelationResolver implements Singleton * @param TcaTableService $service * @param array $record */ - public function resolveRelationsForRecord(TcaTableService $service, array &$record) + public function resolveRelationsForRecord(TcaTableService $service, array &$record) : void { - $formData = GeneralUtility::makeInstance( - FormDataCompiler::class, - GeneralUtility::makeInstance(TcaDatabaseRecord::class) - )->compile([ - 'tableName' => $service->getTableName(), - 'vanillaUid' => (int)$record['uid'], - 'command' => 'edit', - ]); - $record = $formData['databaseRow']; - foreach (array_keys($record) as $column) { + // TODO: Define / configure fields to exclude?! + if ($column === 'pid') { + continue; + } + $record[$column] = BackendUtility::getProcessedValueExtra($service->getTableName(), $column, $record[$column], 0, $record['uid']); + try { $config = $service->getColumnConfig($column); + + if ($this->isRelation($config)) { + $record[$column] = $this->resolveValue($record[$column], $config); + } } catch (InvalidArgumentException $e) { // Column is not configured. - continue; } - - if (! $this->isRelation($config) || !is_array($formData['processedTca']['columns'][$column])) { - continue; - } - - $record[$column] = $this->resolveValue($record[$column], $formData['processedTca']['columns'][$column]); } } /** * Resolve the given value from TYPO3 API response. * - * @param string $value The value from FormEngine to resolve. + * @param mixed $value The value from FormEngine to resolve. * @param array $tcaColumn The tca config of the relation. * * @return array|string @@ -83,15 +76,10 @@ class RelationResolver implements Singleton if ($value === '' || $value === '0') { return ''; } - if ($tcaColumn['config']['type'] === 'select') { - return $this->resolveSelectValue($value, $tcaColumn); - } - if ($tcaColumn['config']['type'] === 'group' && strpos($value, '|') !== false) { + + if ($tcaColumn['type'] === 'select' || $tcaColumn['type'] === 'group') { return $this->resolveForeignDbValue($value); } - if ($tcaColumn['config']['type'] === 'inline') { - return $this->resolveInlineValue($tcaColumn); - } return ''; } @@ -100,66 +88,24 @@ class RelationResolver implements Singleton * @param array Column config. * @return bool */ - protected function isRelation(array &$config) + protected function isRelation(array &$config) : bool { return isset($config['foreign_table']) - || (isset($config['items']) && is_array($config['items'])) + || (isset($config['renderType']) && $config['renderType'] !== 'selectSingle') || (isset($config['internal_type']) && strtolower($config['internal_type']) === 'db') ; } - /** - * Resolves internal representation of select to array of labels. - * - * @param array $value - * @param array $tcaColumn - * @return array - */ - protected function resolveSelectValue(array $values, array $tcaColumn) - { - $resolvedValues = []; - - foreach ($tcaColumn['config']['items'] as $item) { - if (in_array($item[1], $values)) { - $resolvedValues[] = $item[0]; - } - } - - if ($tcaColumn['config']['renderType'] === 'selectSingle' || $tcaColumn['config']['maxitems'] === 1) { - return current($resolvedValues); - } - - return $resolvedValues; - } - /** * @param string $value * * @return array */ - protected function resolveForeignDbValue($value) + protected function resolveForeignDbValue(string $value) : array { - $titles = []; - - foreach (explode(',', urldecode($value)) as $title) { - $titles[] = explode('|', $title)[1]; + if ($value === 'N/A') { + return []; } - - return $titles; - } - - /** - * @param array $tcaColumn - * @return array - */ - protected function resolveInlineValue(array $tcaColumn) - { - $titles = []; - - foreach ($tcaColumn['children'] as $selected) { - $titles[] = $selected['recordTitle']; - } - - return $titles; + return array_map('trim', explode(';', $value)); } } diff --git a/Classes/Domain/Index/TcaIndexer/TcaTableService.php b/Classes/Domain/Index/TcaIndexer/TcaTableService.php index 65adf70..77b7578 100644 --- a/Classes/Domain/Index/TcaIndexer/TcaTableService.php +++ b/Classes/Domain/Index/TcaIndexer/TcaTableService.php @@ -21,6 +21,8 @@ namespace Codappix\SearchCore\Domain\Index\TcaIndexer; */ use Codappix\SearchCore\Configuration\ConfigurationContainerInterface; +use Codappix\SearchCore\Database\Doctrine\Join; +use Codappix\SearchCore\Database\Doctrine\Where; use Codappix\SearchCore\Domain\Index\IndexingException; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -92,7 +94,7 @@ class TcaTableService /** * @return string */ - public function getTableName() + public function getTableName() : string { return $this->tableName; } @@ -100,9 +102,9 @@ class TcaTableService /** * @return string */ - public function getTableClause() + public function getTableClause() : string { - return $this->tableName . ' LEFT JOIN pages on ' . $this->tableName . '.pid = pages.uid'; + return $this->tableName; } /** @@ -111,7 +113,7 @@ class TcaTableService * @param array &$records * @return void */ - public function filterRecordsByRootLineBlacklist(array &$records) + public function filterRecordsByRootLineBlacklist(array &$records) : void { $records = array_filter( $records, @@ -125,7 +127,7 @@ class TcaTableService * Adjust record accordingly to configuration. * @param array &$record */ - public function prepareRecord(array &$record) + public function prepareRecord(array &$record) : void { $this->relationResolver->resolveRelationsForRecord($this, $record); @@ -137,11 +139,9 @@ class TcaTableService } } - /** - * @return string - */ - public function getWhereClause() + public function getWhereClause() : Where { + $parameters = []; $whereClause = $this->getSystemWhereClause(); $userDefinedWhere = $this->configuration->getIfExists('indexing.' . $this->getTableName() . '.additionalWhereClause'); if (is_string($userDefinedWhere)) { @@ -149,16 +149,41 @@ class TcaTableService } if ($this->isBlacklistedRootLineConfigured()) { - $whereClause .= ' AND pages.uid NOT IN (' - . implode(',', $this->getBlacklistedRootLine()) - . ')' - . ' AND pages.pid NOT IN (' - . implode(',', $this->getBlacklistedRootLine()) - . ')'; + $parameters[':blacklistedRootLine'] = $this->getBlacklistedRootLine(); + $whereClause .= ' AND pages.uid NOT IN (:blacklistedRootLine)' + . ' AND pages.pid NOT IN (:blacklistedRootLine)'; } $this->logger->debug('Generated where clause.', [$this->tableName, $whereClause]); - return $whereClause; + return new Where($whereClause, $parameters); + } + + public function getFields() : array + { + $fields = array_merge( + ['uid','pid'], + array_filter( + array_keys($this->tca['columns']), + function ($columnName) { + return !$this->isSystemField($columnName); + } + ) + ); + + foreach ($fields as $key => $field) { + $fields[$key] = $this->tableName . '.' . $field; + } + + $this->logger->debug('Generated fields.', [$this->tableName, $fields]); + return $fields; + return implode(', ', $fields); + } + + public function getJoins() : array + { + return [ + new Join('pages', 'pages.uid = ' . $this->tableName . '.pid'), + ]; } /** @@ -177,34 +202,11 @@ class TcaTableService ; } - /** - * @return string - */ - public function getFields() - { - $fields = array_merge( - ['uid','pid'], - array_filter( - array_keys($this->tca['columns']), - function ($columnName) { - return !$this->isSystemField($columnName); - } - ) - ); - - foreach ($fields as $key => $field) { - $fields[$key] = $this->tableName . '.' . $field; - } - - $this->logger->debug('Generated fields.', [$this->tableName, $fields]); - return implode(',', $fields); - } - /** * @param string * @return bool */ - protected function isSystemField($columnName) + protected function isSystemField($columnName) : bool { $systemFields = [ // Versioning fields, @@ -228,7 +230,7 @@ class TcaTableService * @return array * @throws InvalidArgumentException */ - public function getColumnConfig($columnName) + public function getColumnConfig($columnName) : array { if (!isset($this->tca['columns'][$columnName])) { throw new InvalidArgumentException( @@ -250,7 +252,7 @@ class TcaTableService * @param array &$record * @return bool */ - protected function isRecordBlacklistedByRootline(array &$record) + protected function isRecordBlacklistedByRootline(array &$record) : bool { // If no rootline exists, the record is on a unreachable page and therefore blacklisted. $rootline = BackendUtility::BEgetRootLine($record['pid']); @@ -275,7 +277,7 @@ class TcaTableService * * @return bool */ - protected function isBlackListedRootLineConfigured() + protected function isBlackListedRootLineConfigured() : bool { return (bool) $this->configuration->getIfExists('indexing.' . $this->getTableName() . '.rootLineBlacklist'); } @@ -285,7 +287,7 @@ class TcaTableService * * @return array */ - protected function getBlackListedRootLine() + protected function getBlackListedRootLine() : array { return GeneralUtility::intExplode(',', $this->configuration->getIfExists('indexing.' . $this->getTableName() . '.rootLineBlacklist')); } diff --git a/Makefile b/Makefile index 87bcdfc..b6bc72b 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,6 @@ functionalTests: typo3DatabaseHost=$(typo3DatabaseHost) \ TYPO3_PATH_WEB=$(TYPO3_WEB_DIR) \ .Build/bin/phpunit --colors --debug -v \ - --stop-on-error \ -c Tests/Functional/FunctionalTests.xml unitTests: diff --git a/Tests/Functional/Connection/Elasticsearch/FilterTest.php b/Tests/Functional/Connection/Elasticsearch/FilterTest.php index aa5a5dc..f0b8404 100644 --- a/Tests/Functional/Connection/Elasticsearch/FilterTest.php +++ b/Tests/Functional/Connection/Elasticsearch/FilterTest.php @@ -55,7 +55,7 @@ class FilterTest extends AbstractFunctionalTestCase $searchRequest->setFilter(['CType' => 'HTML']); $result = $searchService->search($searchRequest); - $this->assertSame('5', $result->getResults()[0]['uid'], 'Did not get the expected result entry.'); + $this->assertSame(5, $result->getResults()[0]['uid'], 'Did not get the expected result entry.'); $this->assertSame(1, count($result), 'Did not receive the single filtered element.'); } diff --git a/Tests/Functional/Connection/Elasticsearch/IndexTcaTableTest.php b/Tests/Functional/Connection/Elasticsearch/IndexTcaTableTest.php index 9678d83..8a76c77 100644 --- a/Tests/Functional/Connection/Elasticsearch/IndexTcaTableTest.php +++ b/Tests/Functional/Connection/Elasticsearch/IndexTcaTableTest.php @@ -150,7 +150,7 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase ['_source' => [ 'uid' => '9', 'CType' => 'Header', // Testing items - 'categories' => ['Category 1', 'Category 2'], // Testing mm (with sorting) + 'categories' => ['Category 2', 'Category 1'], // Testing mm ]], $response->getData()['hits']['hits'][0], false, diff --git a/Tests/Unit/Domain/Index/TcaIndexer/TcaTableServiceTest.php b/Tests/Unit/Domain/Index/TcaIndexer/TcaTableServiceTest.php index 330c16e..58c03b4 100644 --- a/Tests/Unit/Domain/Index/TcaIndexer/TcaTableServiceTest.php +++ b/Tests/Unit/Domain/Index/TcaIndexer/TcaTableServiceTest.php @@ -64,9 +64,14 @@ class TcaTableServiceTest extends AbstractUnitTestCase ->method('getSystemWhereClause') ->will($this->returnValue('1=1 AND pages.no_search = 0')); + $whereClause =$this->subject->getWhereClause(); $this->assertSame( '1=1 AND pages.no_search = 0', - $this->subject->getWhereClause() + $whereClause->getStatement() + ); + $this->assertSame( + [], + $whereClause->getParameters() ); } @@ -83,9 +88,14 @@ class TcaTableServiceTest extends AbstractUnitTestCase ->method('getSystemWhereClause') ->will($this->returnValue('1=1 AND pages.no_search = 0')); + $whereClause = $this->subject->getWhereClause(); $this->assertSame( '1=1 AND pages.no_search = 0 AND table.field = "someValue"', - $this->subject->getWhereClause() + $whereClause->getStatement() + ); + $this->assertSame( + [], + $whereClause->getParameters() ); } } From d61a86f8fefd6f0eb36d9c3262d6f5fc534f7cab Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Fri, 7 Jul 2017 16:14:41 +0200 Subject: [PATCH 06/16] TASK: Finish TYPO3 CMS 8 update --- Classes/Database/Doctrine/Where.php | 3 --- Classes/Domain/Index/TcaIndexer/RelationResolver.php | 12 ++++++++++-- .../Hooks/DataHandler/AbstractDataHandlerTest.php | 3 +-- .../Hooks/DataHandler/ProcessesAllowedTablesTest.php | 11 ++++++----- .../Indexing/TcaIndexer/RelationResolverTest.php | 6 +----- ext_localconf.php | 4 ++-- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Classes/Database/Doctrine/Where.php b/Classes/Database/Doctrine/Where.php index 3398991..6586b8a 100644 --- a/Classes/Database/Doctrine/Where.php +++ b/Classes/Database/Doctrine/Where.php @@ -20,9 +20,6 @@ namespace Codappix\SearchCore\Database\Doctrine; * 02110-1301, USA. */ -/** - * - */ class Where { /** diff --git a/Classes/Domain/Index/TcaIndexer/RelationResolver.php b/Classes/Domain/Index/TcaIndexer/RelationResolver.php index 93cfffb..bfc0cc4 100644 --- a/Classes/Domain/Index/TcaIndexer/RelationResolver.php +++ b/Classes/Domain/Index/TcaIndexer/RelationResolver.php @@ -73,13 +73,16 @@ class RelationResolver implements Singleton */ protected function resolveValue($value, array $tcaColumn) { - if ($value === '' || $value === '0') { + if ($value === '') { return ''; } - if ($tcaColumn['type'] === 'select' || $tcaColumn['type'] === 'group') { + if ($tcaColumn['type'] === 'select') { return $this->resolveForeignDbValue($value); } + if ($tcaColumn['type'] === 'inline' || $tcaColumn['type'] === 'group') { + return $this->resolveInlineValue($value); + } return ''; } @@ -108,4 +111,9 @@ class RelationResolver implements Singleton } return array_map('trim', explode(';', $value)); } + + protected function resolveInlineValue(string $value) : array + { + return array_map('trim', explode(',', $value)); + } } diff --git a/Tests/Functional/Hooks/DataHandler/AbstractDataHandlerTest.php b/Tests/Functional/Hooks/DataHandler/AbstractDataHandlerTest.php index 40b64ea..0b0f128 100644 --- a/Tests/Functional/Hooks/DataHandler/AbstractDataHandlerTest.php +++ b/Tests/Functional/Hooks/DataHandler/AbstractDataHandlerTest.php @@ -50,7 +50,6 @@ abstract class AbstractDataHandlerTest extends AbstractFunctionalTestCase ->setMethods(['add', 'update', 'delete']) ->getMock(); - // This way TYPO3 will use our mock instead of a new instance. - $GLOBALS['T3_VAR']['getUserObj']['&' . DataHandlerHook::class] = new DataHandlerHook($this->subject); + GeneralUtility::setSingletonInstance(\Codappix\SearchCore\Hook\DataHandler::class, new DataHandlerHook($this->subject)); } } diff --git a/Tests/Functional/Hooks/DataHandler/ProcessesAllowedTablesTest.php b/Tests/Functional/Hooks/DataHandler/ProcessesAllowedTablesTest.php index 715fe29..7fa1cc5 100644 --- a/Tests/Functional/Hooks/DataHandler/ProcessesAllowedTablesTest.php +++ b/Tests/Functional/Hooks/DataHandler/ProcessesAllowedTablesTest.php @@ -47,7 +47,8 @@ class ProcessesAllowedTablesTest extends AbstractDataHandlerTest */ public function deletionWillBeTriggeredForTtContent() { - $this->subject->expects($this->exactly(1))->method('delete') + $this->subject->expects($this->exactly(1)) + ->method('delete') ->with($this->equalTo('tt_content'), $this->equalTo('1')); $tce = GeneralUtility::makeInstance(Typo3DataHandler::class); @@ -71,9 +72,9 @@ class ProcessesAllowedTablesTest extends AbstractDataHandlerTest ->with( $this->equalTo('tt_content'), $this->callback(function ($record) { - return isset($record['uid']) && $record['uid'] === '1' - && isset($record['pid']) && $record['pid'] === '1' - && isset($record['colPos']) && $record['colPos'] === '1' + return isset($record['uid']) && $record['uid'] === 1 + && isset($record['pid']) && $record['pid'] === 1 + && isset($record['colPos']) && $record['colPos'] === 1 ; }) ); @@ -99,7 +100,7 @@ class ProcessesAllowedTablesTest extends AbstractDataHandlerTest ->with( $this->equalTo('tt_content'), $this->callback(function ($record) { - return isset($record['uid']) && $record['uid'] === 2 + return isset($record['uid']) && $record['uid'] === '2' && isset($record['pid']) && $record['pid'] === 1 && isset($record['header']) && $record['header'] === 'a new record' ; diff --git a/Tests/Functional/Indexing/TcaIndexer/RelationResolverTest.php b/Tests/Functional/Indexing/TcaIndexer/RelationResolverTest.php index 5577ac0..a491677 100644 --- a/Tests/Functional/Indexing/TcaIndexer/RelationResolverTest.php +++ b/Tests/Functional/Indexing/TcaIndexer/RelationResolverTest.php @@ -37,10 +37,6 @@ class RelationResolverTest extends AbstractFunctionalTestCase $objectManager = GeneralUtility::makeInstance(ObjectManager::class); $table = 'sys_file'; - // Only by adding the field to showitem, it will be processed by FormEngine. - // We use this field to test inline relations, as there is only one alternative. - $GLOBALS['TCA']['sys_file']['types'][1]['showitem'] .= ',metadata'; - $subject = $objectManager->get(TcaTableService::class, $table); $record = BackendUtility::getRecord($table, 1); $subject->prepareRecord($record); @@ -113,8 +109,8 @@ class RelationResolverTest extends AbstractFunctionalTestCase $this->assertEquals( [ - 'Category 1', 'Category 2', + 'Category 1', ], $record['categories'], 'Foreign mm select relation was not resolved as expected.' diff --git a/ext_localconf.php b/ext_localconf.php index 1c1f9cd..54bf43b 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -16,10 +16,10 @@ call_user_func( ], 't3lib/class.t3lib_tcemain.php' => [ 'processCmdmapClass' => [ - $extensionKey => '&' . \Codappix\SearchCore\Hook\DataHandler::class, + $extensionKey => \Codappix\SearchCore\Hook\DataHandler::class, ], 'processDatamapClass' => [ - $extensionKey => '&' . \Codappix\SearchCore\Hook\DataHandler::class, + $extensionKey => \Codappix\SearchCore\Hook\DataHandler::class, ], ], ], From a8fdb8a44d79beea2ba3f6af7d5dc4db982f1f6f Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Fri, 7 Jul 2017 16:24:56 +0200 Subject: [PATCH 07/16] TASK: Update dependencies for CMS 8 --- ext_emconf.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext_emconf.php b/ext_emconf.php index 118e2df..4d342a5 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -7,8 +7,8 @@ $EM_CONF[$_EXTKEY] = [ 'clearCacheOnLoad' => 1, 'constraints' => [ 'depends' => [ - 'typo3' => '7.6.0-7.6.99', - 'php' => '5.6.0-7.99.99' + 'typo3' => '8.7.0-8.7.99', + 'php' => '7.1.0-7.99.99' ], 'conflicts' => [], ], From 2cd5debf977c8e1e3893cf645da9624ed73782ae Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Fri, 7 Jul 2017 16:44:57 +0200 Subject: [PATCH 08/16] BUGFIX: Fix broken getRecord method Also add test covering method. --- Classes/Domain/Index/TcaIndexer.php | 43 ++++++++++--------- .../Elasticsearch/IndexTcaTableTest.php | 23 ++++++++++ 2 files changed, 46 insertions(+), 20 deletions(-) diff --git a/Classes/Domain/Index/TcaIndexer.php b/Classes/Domain/Index/TcaIndexer.php index 18444ce..7923565 100644 --- a/Classes/Domain/Index/TcaIndexer.php +++ b/Classes/Domain/Index/TcaIndexer.php @@ -22,6 +22,7 @@ namespace Codappix\SearchCore\Domain\Index; use Codappix\SearchCore\Connection\ConnectionInterface; use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Database\Query\QueryBuilder; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -53,21 +54,11 @@ class TcaIndexer extends AbstractIndexer */ protected function getRecords($offset, $limit) { - $queryBuilder = $this->getDatabaseConnection()->getQueryBuilderForTable($this->tcaTableService->getTableName()); - $where = $this->tcaTableService->getWhereClause(); - $query = $queryBuilder->select(... $this->tcaTableService->getFields()) - ->from($this->tcaTableService->getTableClause()) - ->where($where->getStatement()) - ->setParameters($where->getParameters()) + $records = $this->getQuery() ->setFirstResult($offset) - ->setMaxResults($limit); - - foreach ($this->tcaTableService->getJoins() as $join) { - $query->from($join->getTable()); - $query->andWhere($join->getCondition()); - } - - $records = $query->execute()->fetchAll(); + ->setMaxResults($limit) + ->execute() + ->fetchAll(); if ($records === null) { return null; @@ -88,12 +79,7 @@ class TcaIndexer extends AbstractIndexer */ protected function getRecord($identifier) { - $record = $this->getDatabaseConnection()->exec_SELECTgetSingleRow( - $this->tcaTableService->getFields(), - $this->tcaTableService->getTableClause(), - $this->tcaTableService->getWhereClause() - . ' AND ' . $this->tcaTableService->getTableName() . '.uid = ' . (int) $identifier - ); + $record = $this->getQuery()->execute()->fetch(); if ($record === false || $record === null) { throw new NoRecordFoundException( @@ -114,6 +100,23 @@ class TcaIndexer extends AbstractIndexer return $this->tcaTableService->getTableName(); } + protected function getQuery() : QueryBuilder + { + $queryBuilder = $this->getDatabaseConnection()->getQueryBuilderForTable($this->tcaTableService->getTableName()); + $where = $this->tcaTableService->getWhereClause(); + $query = $queryBuilder->select(... $this->tcaTableService->getFields()) + ->from($this->tcaTableService->getTableClause()) + ->where($where->getStatement()) + ->setParameters($where->getParameters()); + + foreach ($this->tcaTableService->getJoins() as $join) { + $query->from($join->getTable()); + $query->andWhere($join->getCondition()); + } + + return $query; + } + protected function getDatabaseConnection() { return GeneralUtility::makeInstance(ConnectionPool::class); diff --git a/Tests/Functional/Connection/Elasticsearch/IndexTcaTableTest.php b/Tests/Functional/Connection/Elasticsearch/IndexTcaTableTest.php index 8a76c77..7210e01 100644 --- a/Tests/Functional/Connection/Elasticsearch/IndexTcaTableTest.php +++ b/Tests/Functional/Connection/Elasticsearch/IndexTcaTableTest.php @@ -59,6 +59,29 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase ); } + /** + * @test + */ + public function indexSingleBasicTtContent() + { + \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class) + ->get(IndexerFactory::class) + ->getIndexer('tt_content') + ->indexDocument(6) + ; + + $response = $this->client->request('typo3content/_search?q=*:*'); + + $this->assertTrue($response->isOK(), 'Elastica did not answer with ok code.'); + $this->assertSame($response->getData()['hits']['total'], 1, 'Not exactly 1 document was indexed.'); + $this->assertArraySubset( + ['_source' => ['header' => 'indexed content element']], + $response->getData()['hits']['hits'][0], + false, + 'Record was not indexed.' + ); + } + /** * @test * @expectedException \Codappix\SearchCore\Domain\Index\IndexingException From 9fff750e852343091fec047139b9fa2c2663ba5e Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Fri, 7 Jul 2017 16:29:16 +0200 Subject: [PATCH 09/16] BUGFIX: Fix TypoScript warning Constants can't use multi line strings. --- Configuration/TypoScript/constants.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Configuration/TypoScript/constants.txt b/Configuration/TypoScript/constants.txt index f97c039..149d610 100644 --- a/Configuration/TypoScript/constants.txt +++ b/Configuration/TypoScript/constants.txt @@ -14,10 +14,7 @@ plugin { # should also be added, together with additionalWhereClause # based on doktypes tt_content { - additionalWhereClause ( - pages.doktype NOT IN (3, 199) - AND tt_content.CType NOT IN ('gridelements_pi1', 'list', 'div', 'menu', 'shortcut', 'search', 'login') - ) + additionalWhereClause = pages.doktype NOT IN (3, 199) AND tt_content.CType NOT IN ('gridelements_pi1', 'list', 'div', 'menu', 'shortcut', 'search', 'login') } } } From 31937d2d6f671bbe5ac5bc6eeb2792a5afeb84a9 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Fri, 28 Jul 2017 11:58:24 +0200 Subject: [PATCH 10/16] BUGFIX: Fix broken test --- Tests/Unit/Domain/Search/QueryFactoryTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Tests/Unit/Domain/Search/QueryFactoryTest.php b/Tests/Unit/Domain/Search/QueryFactoryTest.php index 33ef852..9ff690a 100644 --- a/Tests/Unit/Domain/Search/QueryFactoryTest.php +++ b/Tests/Unit/Domain/Search/QueryFactoryTest.php @@ -153,6 +153,9 @@ class QueryFactoryTest extends AbstractUnitTestCase */ public function sizeIsAddedToQuery() { + $this->configuration->expects($this->any()) + ->method('get') + ->will($this->throwException(new InvalidArgumentException)); $searchRequest = new SearchRequest('SearchWord'); $searchRequest->setSize(45); From 67d1180ee18b9d4dcc57d2fad7b10f976da12527 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 8 Aug 2017 10:36:50 +0200 Subject: [PATCH 11/16] TASK: Remove php 7.0 testing As we do not support PHP 7.0. --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ea6d947..21d058f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,6 @@ before_install: language: php php: - - 7.0 - 7.1 env: @@ -31,8 +30,6 @@ env: matrix: fast_finish: true allow_failures: - - env: TYPO3_VERSION="dev-master" - php: 7.0 - env: TYPO3_VERSION="dev-master" php: 7.1 From 49a56496c6cd301d01451ab86772b573d5c6b2e1 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 8 Aug 2017 11:54:32 +0200 Subject: [PATCH 12/16] TASK: Fix codacy issues Break line to not exceed maximum line length. Use imported namespace to shorten line. --- Classes/Domain/Index/TcaIndexer/RelationResolver.php | 8 +++++++- .../Hooks/DataHandler/AbstractDataHandlerTest.php | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Classes/Domain/Index/TcaIndexer/RelationResolver.php b/Classes/Domain/Index/TcaIndexer/RelationResolver.php index 5d5a256..88aa982 100644 --- a/Classes/Domain/Index/TcaIndexer/RelationResolver.php +++ b/Classes/Domain/Index/TcaIndexer/RelationResolver.php @@ -39,7 +39,13 @@ class RelationResolver implements Singleton if ($column === 'pid') { continue; } - $record[$column] = BackendUtility::getProcessedValueExtra($service->getTableName(), $column, $record[$column], 0, $record['uid']); + $record[$column] = BackendUtility::getProcessedValueExtra( + $service->getTableName(), + $column, + $record[$column], + 0, + $record['uid'] + ); try { $config = $service->getColumnConfig($column); diff --git a/Tests/Functional/Hooks/DataHandler/AbstractDataHandlerTest.php b/Tests/Functional/Hooks/DataHandler/AbstractDataHandlerTest.php index 0b0f128..84ac0bd 100644 --- a/Tests/Functional/Hooks/DataHandler/AbstractDataHandlerTest.php +++ b/Tests/Functional/Hooks/DataHandler/AbstractDataHandlerTest.php @@ -50,6 +50,6 @@ abstract class AbstractDataHandlerTest extends AbstractFunctionalTestCase ->setMethods(['add', 'update', 'delete']) ->getMock(); - GeneralUtility::setSingletonInstance(\Codappix\SearchCore\Hook\DataHandler::class, new DataHandlerHook($this->subject)); + GeneralUtility::setSingletonInstance(DataHandlerHook::class, new DataHandlerHook($this->subject)); } } From 51863c9e5daacfe662bbc7676a9383f9ae11eca2 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 10 Aug 2017 08:59:48 +0200 Subject: [PATCH 13/16] TASK: Cleanup PR issues --- Tests/Unit/Domain/Index/TcaIndexer/TcaTableServiceTest.php | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/Unit/Domain/Index/TcaIndexer/TcaTableServiceTest.php b/Tests/Unit/Domain/Index/TcaIndexer/TcaTableServiceTest.php index 58c03b4..7fb0280 100644 --- a/Tests/Unit/Domain/Index/TcaIndexer/TcaTableServiceTest.php +++ b/Tests/Unit/Domain/Index/TcaIndexer/TcaTableServiceTest.php @@ -64,7 +64,7 @@ class TcaTableServiceTest extends AbstractUnitTestCase ->method('getSystemWhereClause') ->will($this->returnValue('1=1 AND pages.no_search = 0')); - $whereClause =$this->subject->getWhereClause(); + $whereClause = $this->subject->getWhereClause(); $this->assertSame( '1=1 AND pages.no_search = 0', $whereClause->getStatement() diff --git a/composer.json b/composer.json index f56b60a..0061751 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ }, "require" : { "php": ">=7.1.0", - "typo3/cms": "~8.2", + "typo3/cms": "~8.7", "ruflin/elastica": "~3.2" }, "require-dev": { From 4b26799e7f86e7fcf0fdf91eb347eeb5f42afc70 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 15 Aug 2017 09:42:18 +0200 Subject: [PATCH 14/16] BUGFIX: Do not test with master of TYPO3 This version only supports V8 of TYPO3 CMS. --- .travis.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9d60175..4490198 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,15 +23,6 @@ env: - typo3DatabaseHost="127.0.0.1" - typo3DatabaseUsername="travis" - typo3DatabasePassword="" - matrix: - - TYPO3_VERSION="~8" - - TYPO3_VERSION="dev-master" - -matrix: - fast_finish: true - allow_failures: - - env: TYPO3_VERSION="dev-master" - php: 7.1 matrix: fast_finish: true From fe754964fe0319d9f3d9a51022882b4108a98d28 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 21 Aug 2017 12:10:34 +0200 Subject: [PATCH 15/16] BUGFIX: Fetch record to update --- Classes/Domain/Index/TcaIndexer.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Classes/Domain/Index/TcaIndexer.php b/Classes/Domain/Index/TcaIndexer.php index 25bef53..b5cb766 100644 --- a/Classes/Domain/Index/TcaIndexer.php +++ b/Classes/Domain/Index/TcaIndexer.php @@ -83,7 +83,10 @@ class TcaIndexer extends AbstractIndexer */ protected function getRecord($identifier) { - $record = $this->getQuery()->execute()->fetch(); + $query = $this->getQuery(); + $query = $query->andWhere($this->tcaTableService->getTableName() . '.uid = ' . (int) $identifier); + $record = $query->execute()->fetch(); + if ($record === false || $record === null) { throw new NoRecordFoundException( From efc2fb7da60448aa760671fab71d4887db84bb10 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Fri, 25 Aug 2017 11:46:46 +0200 Subject: [PATCH 16/16] BUGFIX: Remove pr issue --- Classes/Domain/Index/TcaIndexer.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Classes/Domain/Index/TcaIndexer.php b/Classes/Domain/Index/TcaIndexer.php index b5cb766..c35b9ea 100644 --- a/Classes/Domain/Index/TcaIndexer.php +++ b/Classes/Domain/Index/TcaIndexer.php @@ -87,7 +87,6 @@ class TcaIndexer extends AbstractIndexer $query = $query->andWhere($this->tcaTableService->getTableName() . '.uid = ' . (int) $identifier); $record = $query->execute()->fetch(); - if ($record === false || $record === null) { throw new NoRecordFoundException( 'Record could not be fetched from database: "' . $identifier . '". Perhaps record is not active.',