/**
  * 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();
     }
 }
 /**
  * Create a single instance of the db storage adapter
  * 
  * @return Tx_PtExtbase_State_Session_Storage_DBAdapter
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new Tx_PtExtbase_State_Session_Storage_DBAdapter();
         self::$instance->injectStateCache(self::buildStateCache());
         self::$instance->setStateHash(self::getStateHash());
         self::$instance->init();
     }
     return self::$instance;
 }
Пример #3
0
 /**
  * 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();
     }
 }