diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php index 8dc9259b6955ee9638f1ebb3a7a1f57e3f2230d0..fb90ddb40e0275436363a99c29a7e6c198ca75b9 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php @@ -905,8 +905,11 @@ class Typo3DbQueryParser $fullPropertyPath .= ($fullPropertyPath === '') ? $propertyName : '.' . $propertyName; $childTableAlias = $this->getUniqueAlias($childTableName, $fullPropertyPath); - // If there is already exists a union with the current identifier we do not need to build it again and exit early. + // If there is already a union with the current identifier we do not need to build it again and exit early. if (in_array($childTableAlias, $this->unionTableAliasCache, true)) { + $propertyPath = $explodedPropertyPath[1]; + $tableName = $childTableAlias; + $className = $this->dataMapper->getType($className, $propertyName); return; } diff --git a/typo3/sysext/extbase/Tests/Functional/Persistence/CountTest.php b/typo3/sysext/extbase/Tests/Functional/Persistence/CountTest.php index 87a5367a3eb4f036bafcc5d4f74045b3e8945f06..79ab879e2ef278253b955de2e10ced16e7345af9 100644 --- a/typo3/sysext/extbase/Tests/Functional/Persistence/CountTest.php +++ b/typo3/sysext/extbase/Tests/Functional/Persistence/CountTest.php @@ -197,7 +197,11 @@ class CountTest extends \TYPO3\CMS\Components\TestingFramework\Core\FunctionalTe ) ); - $this->assertSame(10, $query->count()); + // QueryResult is lazy, so we have to run valid method to initialize + $result = $query->execute(); + $result->valid(); + + $this->assertSame(10, $result->count()); } /**