Bug #84535
openProblems with DatabaseTreeDataProvider and parentField having a MM configuration
0%
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.
Updated by Hannes Bochmann over 6 years ago
The problem with the MM table being queried on the root level applies for child relations (childrenField), too. The MM configuration shouldn't be considered on the root level as well.
Updated by Susanne Moog over 4 years ago
- Category set to FormEngine aka TCEforms