Project

General

Profile

Actions

Bug #94141

closed

Hidden records are taken into account in m:n relations but instantiated as empty objects

Added by Julian Hofmann almost 3 years ago. Updated almost 3 years ago.

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

0%

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

Description

Since v10.4.16 domain properties to hidden records are counting in the parent model but are instantiated as empty objects.

Short Example:
A news record has relations to two categories "Category 1" and "Category 2". The first one is a hidden record.

Till TYPO3 v10.4.15 (Bildschirmfoto 2021-05-14 um 15.43.30.png):

DebuggerUtility::var_dump($news->getCategories(), __METHOD__);

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage (1 items)

Since TYPO3 v10.4.16 (Bildschirmfoto 2021-05-14 um 15.45.12.png):

DebuggerUtility::var_dump($news->getCategories(), __METHOD__);

TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage (2 items)


Files


Related issues 2 (0 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
Is duplicate of TYPO3 Core - Bug #94119: Ghost record for field with mm relation when relation record is disabledClosedMarkus Klein2021-05-12

Actions
Actions #1

Updated by Julian Hofmann almost 3 years ago

Steps to reproduce:

  • ddev composer create "typo3/cms-base-distribution:^10" --prefer-dist
  • ddev composer req georgringer/news
  • touch public/FIRST_INSTALL
  • Walk through Install-tool
  • Login into BE
  • Create Page "Home" and sysfolder "News"
  • Create new TS-template on "Home", including static templates FSC & news and TS
    page = PAGE
    page.20 < styles.content.get
    
  • Create 2 categories in sysfolder "News"
  • Hide one of the categories
  • Create News record connected to both categories
  • Create news plugin on "Home"
  • Debug single $news record in any way.
  • Downgrade to TYPO3 v10.5.15
  • Debug single $news record again
Actions #2

Updated by Chris Müller almost 3 years ago

  • Is duplicate of Bug #94119: Ghost record for field with mm relation when relation record is disabled added
Actions #3

Updated by Nikita Hovratov almost 3 years ago

  • Related to Bug #88919: QueryBuilder with DefaultRestrictionContainer effectivly transforms outer joins to inner joins because the restrictions are applied to all join tables unconditionally added
Actions #4

Updated by Nikita Hovratov almost 3 years ago

  • Category set to Database API (Doctrine DBAL)

For comparison:

/* v10.4.15 */

SELECT `sys_category_record_mm`.*, `sys_category`.*
FROM `sys_category_record_mm` `sys_category_record_mm`
LEFT JOIN `sys_category` `sys_category`
ON `sys_category_record_mm`.`uid_local` = `sys_category`.`uid`
WHERE (
              (`sys_category_record_mm`.`uid_foreign` = 1)
          AND (`sys_category_record_mm`.`fieldname` = 'categories')
      )
      AND (`sys_category_record_mm`.`tablenames` = 'tx_news_domain_model_news')
      AND (
            (
                    (`sys_category`.`deleted` = 0)
                AND (`sys_category`.`t3ver_state` <= 0)
                AND (`sys_category`.`t3ver_wsid` = 0)
                AND (`sys_category`.`t3ver_oid` = 0)
                AND (`sys_category`.`hidden` = 0)
                AND (`sys_category`.`starttime` <= 1621118040)
                AND ((`sys_category`.`endtime` = 0) OR (`sys_category`.`endtime` > 1621118040))
            )
            OR (`sys_category`.`uid` IS NULL)
          )
      AND (
                (`sys_category`.`deleted` = 0)
            AND (`sys_category`.`hidden` = 0)
            AND (`sys_category`.`starttime` <= 1621118040)
            AND ((`sys_category`.`endtime` = 0) OR (`sys_category`.`endtime` > 1621118040))
          )

ORDER BY `sys_category_record_mm`.`sorting_foreign` ASC

/* 10.4.16 */

SELECT `sys_category_record_mm`.*, `sys_category`.*
FROM `sys_category_record_mm` `sys_category_record_mm`
LEFT JOIN `sys_category` `sys_category`
ON (`sys_category_record_mm`.`uid_local` = `sys_category`.`uid`)
AND (
            (`sys_category`.`deleted` = 0)
        AND (`sys_category`.`hidden` = 0)
        AND (`sys_category`.`starttime` <= 1621117560)
        AND ((`sys_category`.`endtime` = 0) OR (`sys_category`.`endtime` > 1621117560))
    )
WHERE (
        (
                (`sys_category_record_mm`.`uid_foreign` = 1)
            AND (`sys_category_record_mm`.`fieldname` = 'categories')
        )
        AND (`sys_category_record_mm`.`tablenames` = 'tx_news_domain_model_news')
    )
  AND (
        (
                (`sys_category`.`deleted` = 0)
            AND (`sys_category`.`t3ver_state` <= 0)
            AND (`sys_category`.`t3ver_wsid` = 0)
            AND (`sys_category`.`t3ver_oid` = 0)
            AND (`sys_category`.`hidden` = 0)
            AND (`sys_category`.`starttime` <= 1621117560)
            AND ((`sys_category`.`endtime` = 0) OR (`sys_category`.`endtime` > 1621117560))
        )
        OR (`sys_category`.`uid` IS NULL)
    )
ORDER BY `sys_category_record_mm`.`sorting_foreign` ASC
Actions #5

Updated by Nikita Hovratov almost 3 years ago

I guess the behaviour of the LEFT JOIN is correct to return the row with NULL values so far. But the WHERE restriction is now not working anymore because of the OR (`sys_category`.`uid` IS NULL) condition. Not sure where this is set or needed.

Actions #6

Updated by Markus Klein almost 3 years ago

  • Category changed from Database API (Doctrine DBAL) to Extbase
  • Status changed from New to Closed
  • Priority changed from Should have to Must have
  • TYPO3 Version changed from 10 to 9

Closing this as duplicate.

Actions #7

Updated by Markus Klein almost 3 years ago

  • TYPO3 Version changed from 9 to 10
Actions

Also available in: Atom PDF