Bug #94141
closed
Hidden records are taken into account in m:n relations but instantiated as empty objects
Added by Julian Hofmann over 3 years ago.
Updated about 3 years ago.
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
Steps to reproduce:
- Downgrade to TYPO3 v10.5.15
- Debug single $news record again
- Is duplicate of Bug #94119: Ghost record for field with mm relation when relation record is disabled added
- 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
- 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
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.
- 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.
- TYPO3 Version changed from 9 to 10
Also available in: Atom
PDF