Project

General

Profile

Actions

Bug #102355

open

Extbase resolves all 1:n relations even though count indicates no releations

Added by Alexander Schnitzler 6 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2023-11-09
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Extbases DataMapper resolves relations to other entities. 1:n relations usually store a relation count on the parent, so whenever it shows 0, it wouldn't be necessary to try to fetch relations. This saves 1 query per relation but in certain scenarios with many entities and relations this saves tons of superfluous db operations.

protected function fetchRelatedEager(DomainObjectInterface $parentObject, $propertyName, $fieldValue = '')
{
    return $fieldValue === '' ? $this->getEmptyRelationValue($parentObject, $propertyName) : $this->getNonEmptyRelationValue($parentObject, $propertyName, $fieldValue);
}

This method already tries to be smart but it only sees empty strings as empty relation value.

Proposal: Expect the $fieldValue to hold an integer, cast other types to int and evaluate if said int is 0. https://3v4l.org/mqsvQ

No data to display

Actions

Also available in: Atom PDF