‪TYPO3CMS  10.4
QueryFactory.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
24 
30 {
34  protected ‪$objectManager;
35 
39  protected ‪$configurationManager;
40 
44  protected ‪$dataMapFactory;
45 
51  public function ‪__construct(
55  ) {
56  $this->objectManager = ‪$objectManager;
57  $this->configurationManager = ‪$configurationManager;
58  $this->dataMapFactory = ‪$dataMapFactory;
59  }
60 
68  public function ‪create($className)
69  {
70  $query = $this->objectManager->get(QueryInterface::class, $className);
71  $querySettings = $this->objectManager->get(QuerySettingsInterface::class);
72 
73  $dataMap = $this->dataMapFactory->buildDataMap($className);
74  if ($dataMap->getIsStatic() || $dataMap->getRootLevel()) {
75  $querySettings->setRespectStoragePage(false);
76  }
77 
78  $frameworkConfiguration = $this->configurationManager->getConfiguration(‪ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
79  $querySettings->setStoragePageIds(‪GeneralUtility::intExplode(',', $frameworkConfiguration['persistence']['storagePid'] ?? ''));
80  $query->‪setQuerySettings($querySettings);
81  return $query;
82  }
83 }
‪TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory\create
‪TYPO3 CMS Extbase Persistence QueryInterface create($className)
Definition: QueryFactory.php:65
‪TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory
Definition: QueryFactory.php:30
‪TYPO3\CMS\Extbase\Persistence\QueryInterface
Definition: QueryInterface.php:29
‪TYPO3\CMS\Extbase\Persistence\QueryInterface\setQuerySettings
‪setQuerySettings(QuerySettingsInterface $querySettings)
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
Definition: ConfigurationManagerInterface.php:28
‪TYPO3\CMS\Extbase\Object\ObjectManagerInterface
Definition: ObjectManagerInterface.php:26
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface\CONFIGURATION_TYPE_FRAMEWORK
‪const CONFIGURATION_TYPE_FRAMEWORK
Definition: ConfigurationManagerInterface.php:29
‪TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory\$objectManager
‪TYPO3 CMS Extbase Object ObjectManagerInterface $objectManager
Definition: QueryFactory.php:33
‪TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory
Definition: DataMapFactory.php:42
‪TYPO3\CMS\Extbase\Persistence\Generic\QueryFactoryInterface
Definition: QueryFactoryInterface.php:22
‪TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory\$dataMapFactory
‪TYPO3 CMS Extbase Persistence Generic Mapper DataMapFactory $dataMapFactory
Definition: QueryFactory.php:41
‪TYPO3\CMS\Extbase\Persistence\Generic
Definition: Backend.php:16
‪TYPO3\CMS\Core\SingletonInterface
Definition: SingletonInterface.php:23
‪TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory\__construct
‪__construct(ObjectManagerInterface $objectManager, ConfigurationManagerInterface $configurationManager, DataMapFactory $dataMapFactory)
Definition: QueryFactory.php:48
‪TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory\$configurationManager
‪TYPO3 CMS Extbase Configuration ConfigurationManagerInterface $configurationManager
Definition: QueryFactory.php:37
‪TYPO3\CMS\Core\Utility\GeneralUtility\intExplode
‪static int[] intExplode($delimiter, $string, $removeEmptyValues=false, $limit=0)
Definition: GeneralUtility.php:988
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46