Issue Bug Closed

#82317Queryresult Item-count is wrong with hidden translation items

Anonymous 09/06/17, 15:00 updated 04/03/25, 11:43

Description

Scenario:
  • Having a Domain Model of Type A.
  • 5 A Models in Default language stored in the backend
  • All 5 are translated to a second language, but 4 of the translations are hidden

Acessing a QueryResult via Fluid on a translated page says that the Query Result has 5 Items (even though <f:debug> shows only one)<br>Iterater also says it’s a total of 5 Items (again, even though only 1 is rendered or iteratied through, the one that is not hidden).</f:debug>

If I call a foreach loop in PHP in the controller before returning the query result to the view, everything works as expected and the result shows me only 1 Item, as well as the iterator.

Additional Information:
$querySettings->setRespectStoragePage(FALSE);
$querySettings->setLanguageMode(‘strict’);
are set.

Codes:
Wrong Count:

        $downloads = $this->downloadRepository->findByCategories(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->settings['categories']));

        $this->view->assignMultiple([
            'downloads' => $downloads,
        ]);

Correct count:

        $downloads = $this->downloadRepository->findByCategories(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->settings['categories']));

        foreach ($downloads as $download)
        {
            $test = '';
        }

        $this->view->assignMultiple([
            'downloads' => $downloads,
        ]);

<f:debug> with wrong count:<br><img alt src="https://i.imgur.com/gjQs5kz.png"></f:debug>

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.