‪TYPO3CMS  9.5
QueryFactory.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
22 {
26  protected ‪$objectManager;
27 
31  protected ‪$configurationManager;
32 
36  protected ‪$dataMapFactory;
37 
42  {
43  $this->objectManager = ‪$objectManager;
44  }
45 
50  {
51  $this->configurationManager = ‪$configurationManager;
52  }
53 
57  public function ‪injectDataMapFactory(\‪TYPO3\CMS\‪Extbase\Persistence\Generic\Mapper\DataMapFactory ‪$dataMapFactory)
58  {
59  $this->dataMapFactory = ‪$dataMapFactory;
60  }
61 
69  public function ‪create($className)
70  {
71  $query = $this->objectManager->get(\‪TYPO3\CMS\‪Extbase\Persistence\QueryInterface::class, $className);
72  $querySettings = $this->objectManager->get(\‪TYPO3\CMS\‪Extbase\Persistence\Generic\QuerySettingsInterface::class);
73 
74  $dataMap = $this->dataMapFactory->buildDataMap($className);
75  if ($dataMap->getIsStatic() || $dataMap->getRootLevel()) {
76  $querySettings->setRespectStoragePage(false);
77  }
78 
79  $frameworkConfiguration = $this->configurationManager->getConfiguration(\‪TYPO3\CMS\‪Extbase\Configuration\‪ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
80  $querySettings->setStoragePageIds(\‪TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $frameworkConfiguration['persistence']['storagePid'] ?? ''));
81  $query->‪setQuerySettings($querySettings);
82  return $query;
83  }
84 }
‪TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory\create
‪TYPO3 CMS Extbase Persistence QueryInterface create($className)
Definition: QueryFactory.php:66
‪TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory
Definition: QueryFactory.php:22
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:4
‪TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory\injectConfigurationManager
‪injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager)
Definition: QueryFactory.php:46
‪TYPO3
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
Definition: ConfigurationManagerInterface.php:22
‪TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory\injectObjectManager
‪injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
Definition: QueryFactory.php:38
‪TYPO3\CMS\Extbase\Object\ObjectManagerInterface
Definition: ObjectManagerInterface.php:23
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface\CONFIGURATION_TYPE_FRAMEWORK
‪const CONFIGURATION_TYPE_FRAMEWORK
Definition: ConfigurationManagerInterface.php:23
‪TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory\$objectManager
‪TYPO3 CMS Extbase Object ObjectManagerInterface $objectManager
Definition: QueryFactory.php:25
‪TYPO3\CMS\Extbase\Persistence\Generic\QueryFactoryInterface
Definition: QueryFactoryInterface.php:21
‪TYPO3\CMS\Extbase\Persistence\QueryInterface\setQuerySettings
‪setQuerySettings(Generic\QuerySettingsInterface $querySettings)
‪TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory\$dataMapFactory
‪TYPO3 CMS Extbase Persistence Generic Mapper DataMapFactory $dataMapFactory
Definition: QueryFactory.php:33
‪TYPO3\CMS\Extbase\Persistence\Generic
Definition: Backend.php:2
‪TYPO3\CMS\Core\SingletonInterface
Definition: SingletonInterface.php:22
‪TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory\$configurationManager
‪TYPO3 CMS Extbase Configuration ConfigurationManagerInterface $configurationManager
Definition: QueryFactory.php:29
‪TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory\injectDataMapFactory
‪injectDataMapFactory(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory $dataMapFactory)
Definition: QueryFactory.php:54