/** * Initialize the sessionAdapter * * @return Tx_PtExtbase_State_Session_Storage_AdapterInterface storageAdapter */ private static function getStorageAdapter() { if (\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('Tx_PtExtbase_Context')->isInCachedMode()) { return Tx_PtExtbase_State_Session_Storage_DBAdapterFactory::getInstance(); } else { return Tx_PtExtbase_State_Session_Storage_SessionAdapter::getInstance(); } }
/** * Factory method to get an instance of this class. * * We use factory method of factory here to create the instance to preserve interface for * creating storage adapters. * * @return Tx_PtExtbase_State_Session_Storage_DBAdapter */ public static function getInstance() { return Tx_PtExtbase_State_Session_Storage_DBAdapterFactory::getInstance(); }
/** * Method determines which session storage adapter to use depending on injected context. */ protected function determineSessionStorageAdapterForGivenContext() { if ($this->context->isInCachedMode()) { return Tx_PtExtbase_State_Session_Storage_DBAdapterFactory::getInstance(); } else { return Tx_PtExtbase_State_Session_Storage_SessionAdapter::getInstance(); } }