/**
  * Initialize configuration manager and content object
  *
  * @return void
  */
 protected static function initialize()
 {
     // Get configuration manager
     $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Extbase_Object_ObjectManager');
     self::$configurationManager = $objectManager->get('Tx_Extbase_Configuration_ConfigurationManager');
     // Simulate Frontend
     if (TYPO3_MODE == 'BE') {
         \TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility::simulateFrontendEnvironment();
         if (empty($GLOBALS['TSFE']->sys_page)) {
             $GLOBALS['TSFE']->sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_pageSelect');
         }
         if (empty($GLOBALS['TT'])) {
             $GLOBALS['TT'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_TimeTrackNull');
         }
         self::$configurationManager->setContentObject($GLOBALS['TSFE']->cObj);
     }
     // Get content object
     self::$contentObject = self::$configurationManager->getContentObject();
     if (empty(self::$contentObject)) {
         self::$contentObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tslib_cObj');
     }
     // Reset Frontend if modified
     if (TYPO3_MODE == 'BE') {
         \TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility::resetFrontendEnvironment();
     }
 }
 /**
  * Initialize environment
  *
  * @return void
  */
 protected function initialize()
 {
     // Dummy Extension configuration for Dispatcher
     $configuration = array('extensionName' => 'Randombanners', 'pluginName' => 'List');
     // Get TypoScript configuration
     $setup = Tx_Randombanners_Utility_TypoScript::getSetup();
     $this->settings = Tx_Randombanners_Utility_TypoScript::parse($setup['settings.'], FALSE);
     $configuration = array_merge($configuration, $setup);
     // Load Dispatcher
     $dispatcher = t3lib_div::makeInstance('Tx_Extbase_Core_Bootstrap');
     $dispatcher->initialize($configuration);
     // Load required objects
     $this->objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');
     $this->bannerRepository = t3lib_div::makeInstance('Tx_Randombanners_Domain_Repository_BannerRepository');
     $this->htmlMail = t3lib_div::makeInstance('t3lib_htmlmail');
     $this->persistenceManager = $this->objectManager->get('Tx_Extbase_Persistence_Manager');
 }