File tree Expand file tree Collapse file tree
Classes/Domain/Repository Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121use TYPO3 \CMS \Core \Context \LanguageAspect ;
2222use TYPO3 \CMS \Core \Database \ConnectionPool ;
2323use TYPO3 \CMS \Core \Database \Query \QueryBuilder ;
24+ use TYPO3 \CMS \Core \Database \Query \Restriction \FrontendRestrictionContainer ;
2425use TYPO3 \CMS \Core \Http \ApplicationType ;
2526use TYPO3 \CMS \Core \Utility \GeneralUtility ;
2627use TYPO3 \CMS \Extbase \Persistence \Generic \Qom \AndInterface ;
@@ -384,8 +385,19 @@ public function countByDate(DemandInterface $demand): array
384385 }
385386
386387 if (ApplicationType::fromRequest ($ GLOBALS ['TYPO3_REQUEST ' ])->isFrontend ()) {
387- // @extensionScannerIgnoreLine
388- $ sql .= $ GLOBALS ['TSFE ' ]->sys_page ->enableFields ('tx_news_domain_model_news ' );
388+ $ queryBuilder = $ connection ->createQueryBuilder ();
389+ $ queryBuilder ->getRestrictions ()->removeAll ();
390+ $ queryBuilder ->getRestrictions ()->add (
391+ GeneralUtility::makeInstance (FrontendRestrictionContainer::class)
392+ );
393+ $ queryBuilder ->from ('tx_news_domain_model_news ' );
394+
395+ $ enableFieldsSql = (string )$ queryBuilder
396+ ->getRestrictions ()
397+ ->buildExpression (['tx_news_domain_model_news ' => 'tx_news_domain_model_news ' ], $ queryBuilder ->expr ());
398+ if ($ enableFieldsSql !== '' ) {
399+ $ sql .= ' AND ' . $ enableFieldsSql ;
400+ }
389401 } else {
390402 $ expressionBuilder = $ connection
391403 ->createQueryBuilder ()
You can’t perform that action at this time.
0 commit comments