|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2009 Jochen Rau <jochen.rau@typoplanet.de> 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * 00017 * This script is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * This copyright notice MUST APPEAR in all copies of the script! 00023 ***************************************************************/ 00024 00025 /** 00026 * The QueryFactory used to create queries against the storage backend 00027 * 00028 * @package Extbase 00029 * @subpackage Persistence 00030 * @version $Id$ 00031 */ 00032 class Tx_Extbase_Persistence_QueryFactory implements Tx_Extbase_Persistence_QueryFactoryInterface, t3lib_Singleton { 00033 00034 /** 00035 * @var Tx_Extbase_Object_ObjectManagerInterface 00036 */ 00037 protected $objectManager; 00038 00039 /** 00040 * @var Tx_Extbase_Configuration_ConfigurationManagerInterface 00041 */ 00042 protected $configurationManager; 00043 00044 /** 00045 * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager 00046 * @return void 00047 * @author Sebastian Kurfürst <sebastian@typo3.org> 00048 */ 00049 public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) { 00050 $this->objectManager = $objectManager; 00051 } 00052 00053 /** 00054 * @param Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager 00055 * @return void 00056 */ 00057 public function injectConfigurationManager(Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager) { 00058 $this->configurationManager = $configurationManager; 00059 } 00060 00061 /** 00062 * Creates a query object working on the given class name 00063 * 00064 * @param string $className The class name 00065 * @return Tx_Extbase_Persistence_QueryInterface 00066 */ 00067 public function create($className) { 00068 $query = $this->objectManager->create('Tx_Extbase_Persistence_QueryInterface', $className); 00069 $querySettings = $this->objectManager->create('Tx_Extbase_Persistence_Typo3QuerySettings'); 00070 $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); 00071 $querySettings->setStoragePageIds(t3lib_div::intExplode(',', $frameworkConfiguration['persistence']['storagePid'])); 00072 $query->setQuerySettings($querySettings); 00073 00074 return $query; 00075 } 00076 } 00077 ?>
1.8.0