Project

General

Profile

Actions

Bug #94119

closed

Ghost record for field with mm relation when relation record is disabled

Added by Chris Müller about 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Extbase
Target version:
Start date:
2021-05-12
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
Complexity:
medium
Is Regression:
Yes
Sprint Focus:

Description

Since the update from TYPO3 10.4.15 to 10.4.16 I have "ghost" records with uid=0 and pid=0 in a "related" field when referenced records are disabled.

The TCA configuration:

'related' => [
    'label' => 'Related',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectMultipleSideBySide',
        'foreign_table' => 'tx_video_domain_model_video',
        'foreign_table_where' => ' AND tx_video_domain_model_video.pid = ###REC_FIELD_pid### AND tx_video_domain_model_video.uid != ###THIS_UID### ORDER BY title',
        'MM' => 'tx_video_domain_model_videos_related_mm',
        'MM_opposite_field' => 'related_from',
        'size' => 5,
        'minitems' => 0,
        'maxitems' => 100,
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
],
'related_from' => [
    'label' => 'Related from',
    'config' => [
        'type' => 'group',
        'internal_type' => 'db',
        'foreign_table' => 'tx_video_domain_model_video',
        'allowed' => 'tx_video_domain_model_video',
        'size' => 5,
        'maxitems' => 100,
        'MM' => 'tx_video_domain_model_videos_related_mm',
        'readOnly' => 1,
    ],
],

In the domain model the relevant fields are defined as:

/**
 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\MyVendor\Video\Domain\Model\Video>
 */
protected $related;

/**
 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\MyVendor\Video\Domain\Model\Video>
 */
protected $relatedFrom;

/**
 * Get related videos
 *
 * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\MyVendor\Video\Domain\Model\Video>
 */
public function getRelated()
{
    return $this->related;
}

The getRelated() method returns then this "ghost" record for every related record which is disabled:

Ghost record dump

Going back to TYPO3 10.4.15 only enabled records are available.

Edit: Looks like it is not related to bidirectional fields, just ol' plain relations.


Files

ghostrecord.png (84 KB) ghostrecord.png Ghost record dump Chris Müller, 2021-05-12 08:36

Related issues 3 (1 open2 closed)

Related to TYPO3 Core - Bug #88919: QueryBuilder with DefaultRestrictionContainer effectivly transforms outer joins to inner joins because the restrictions are applied to all join tables unconditionallyClosed2019-08-05

Actions
Related to TYPO3 Core - Bug #91324: Visibility restrictions are added twice for Extbase ObjectStorage relationsNew2020-05-06

Actions
Has duplicate TYPO3 Core - Bug #94141: Hidden records are taken into account in m:n relations but instantiated as empty objects Closed2021-05-14

Actions
Actions

Also available in: Atom PDF