Project

General

Profile

Actions

Bug #84535

open

Problems with DatabaseTreeDataProvider and parentField having a MM configuration

Added by Hannes Bochmann over 6 years ago. Updated over 4 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2018-03-26
Due date:
% Done:

0%

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

Description

In the method \TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeDataProvider::getChildrenUidsFromParentRelation() a dummy field is set for "look from other site". The configuration key of this dummy field is wrong. It is "$this->columnConfiguration['MM_oppositeField']" at the moment but should be "$this->columnConfiguration['MM_opposite_field']"

That's why it's not possible at the moment to use selectTrees if the parentField has a MM relation. This seems not to work anyway as the lookup for the records in the root level is done through the MM table as well as for all other levels. In normal scenarios this is wrong. Only non-root records will have an entry in the MM table. The root records would need to have an entry there as well for this to work at the moment. The solution could be to unset the MM configuration ($this->columnConfiguration['MM']) at the start of getRelatedRecords() if the uid of the row is 0 which means we're on the root level. In this case the foreign_table should be queried for records which have the parentField set to 0. Maybe this is a problem for child relations as well (haven't checked that)

There is a further problem considering MM relations and selectTrees. If the parentField has MM relations it is possible that records have several parents. With the above changes this would work for selectTrees but the display of the tree would be wrong. A record with several parents would only be shown for the first parent. This is because of the idCache in the DatabaseTreeDataProvider. Entries are only added to the tree if their ID was not added previously. I don't know a good solution. Maybe it should be configurable through TCA if the UIDs should be unique or can occur several times.

Actions

Also available in: Atom PDF