Project

General

Profile

Actions

Bug #66574

closed

Relations of definitions using MM_opposite_field are missing in ReferenceIndex

Added by Stephan Großberndt over 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2015-04-24
Due date:
% Done:

0%

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

Description

Consider this TCA definition:

$TCA['tx_myext_a']['columns'] = array(
    'x' => array(
        'config' => array(
            'type' => 'inline',
            'foreign_table' => 'tx_myext_b',
            'MM' => 'tx_myext_a_b_mm',
        )
    ),
);

$TCA['tx_myext_b']['columns'] = array(
    'y' => array(
        'config' => array(
            'type' => 'inline',
            'foreign_table' => 'tx_myext_a',
            'MM' => 'tx_myext_a_b_mm',
            'MM_opposite_field' => 'x',
        )
    ),
); 

References are found and created in sys_refindex by ReferenceIndex->getRelations_procDB() but only for one side:

sys_refindex contains records with tablename "tx_myext_a" being shown as references in web_list if you look at table tx_myext_b

  array(12) {
    ["tablename"]=>
    string(16) "tx_myext_a" 
    ["recuid"]=>
    int(5)
    ["field"]=>
    string(1) "x" 
    ["flexpointer"]=>
    string(0) "" 
    ["softref_key"]=>
    string(0) "" 
    ["softref_id"]=>
    string(0) "" 
    ["sorting"]=>
    int(1)
    ["deleted"]=>
    int(0)
    ["workspace"]=>
    int(0)
    ["ref_table"]=>
    string(12) "tx_myext_b" 
    ["ref_uid"]=>
    string(4) "4544" 
    ["ref_string"]=>
    string(0) "" 
  }

but the references for tx_myext_b shown in tx_myext_a are missing.

This is due to ReferenceIndex->getRelations_procDB()

    public function getRelations_procDB($value, $conf, $uid, $table = '', $field = '') {
        // Get IRRE relations
        if (empty($conf)) {
            return FALSE;
        } elseif ($conf['type'] === 'inline' && !empty($conf['foreign_table']) && empty($conf['MM'])) {
            $dbAnalysis = $this->getRelationHandler();
            $dbAnalysis->setUseLiveReferenceIds(FALSE);
            $dbAnalysis->start($value, $conf['foreign_table'], '', $uid, $table, $conf);
            return $dbAnalysis->itemArray;
        // DB record lists:
        } elseif ($this->isDbReferenceField($conf)) {
            $allowedTables = $conf['type'] == 'group' ? $conf['allowed'] : $conf['foreign_table'] . ',' . $conf['neg_foreign_table'];
            if ($conf['MM_opposite_field']) {
                return array();
            }
            $dbAnalysis = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\RelationHandler');
            $dbAnalysis->start($value, $allowedTables, $conf['MM'], $uid, $table, $conf);
            return $dbAnalysis->itemArray;

If there is a definition in 'MM_opposite_field', an empty array is returned instead of the relations.


Related issues 2 (1 open1 closed)

Related to TYPO3 Core - Task #63928: Why is MM_opposite_field working with inline?Closed2014-12-16

Actions
Related to TYPO3 Core - Bug #23980: Relations with MM_opposite_field don't update the relation count of opposite fieldAccepted2010-11-07

Actions
Actions #1

Updated by Gerrit Code Review over 9 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38903

Actions #2

Updated by Gerrit Code Review over 9 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38903

Actions #3

Updated by Gerrit Code Review over 9 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38903

Actions #4

Updated by Gerrit Code Review over 9 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38903

Actions #5

Updated by Gerrit Code Review over 9 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38903

Actions #6

Updated by Gerrit Code Review over 9 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38903

Actions #7

Updated by Gerrit Code Review over 9 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38903

Actions #8

Updated by Mathias Schreiber about 9 years ago

  • Target version deleted (next-patchlevel)
Actions #9

Updated by Stephan Großberndt about 9 years ago

  • Status changed from Under Review to Closed
Actions

Also available in: Atom PDF