public function __construct()
 {
     /** @var ObjectManager $objectManager */
     $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->mailChimp = $objectManager->get('MatoIlic\\T3Chimp\\Service\\MailChimp');
     $this->mailChimp->initialize();
 }
Exemplo n.º 2
0
 /**
  * This is the main method that is called when a task is executed
  * Note that there is no error handling, errors and failures are expected
  * to be handled and logged by the client implementations.
  * Should return TRUE on successful execution, FALSE on error.
  *
  * @return boolean Returns TRUE on successful execution, FALSE on error
  */
 public function execute()
 {
     $this->extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['t3chimp']);
     /** @var ObjectManager $objectManager */
     $this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
     $this->mailChimp = $this->objectManager->get('MatoIlic\\T3Chimp\\Service\\MailChimp');
     $this->userRepo = $this->objectManager->get('MatoIlic\\T3Chimp\\Domain\\Repository\\FrontendUserRepository');
     $this->configurationManager->setConfiguration(array('extensionName' => 'T3chimp'));
     $typoScriptSetup = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
     if (isset($typoScriptSetup['config.']['tx_extbase.']['objects.'])) {
         $objectContainer = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\Container\\Container');
         foreach ($typoScriptSetup['config.']['tx_extbase.']['objects.'] as $classNameWithDot => $classConfiguration) {
             if (isset($classConfiguration['className'])) {
                 $originalClassName = rtrim($classNameWithDot, '.');
                 $objectContainer->registerImplementation($originalClassName, $classConfiguration['className']);
             }
         }
     }
     /** @var ReflectionService $reflectionService */
     $reflectionService = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
     if (TYPO3_version < '7.1.0') {
         $reflectionService->setDataCache($GLOBALS['typo3CacheManager']->getCache('extbase_reflection'));
     } else {
         $cacheManager = $this->objectManager->get('TYPO3\\CMS\\Core\\Cache\\CacheManager');
         $reflectionService->setDataCache($cacheManager->getCache('extbase_reflection'));
     }
     if (!$reflectionService->isInitialized()) {
         $reflectionService->initialize();
     }
     $this->mailChimp->initialize();
     $state = $this->executeTask();
     /** @var PersistenceManager $persistenceManager */
     $persistenceManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager');
     $persistenceManager->persistAll();
     $reflectionService->shutdown();
     return $state;
 }
Exemplo n.º 3
0
 protected function initializeAction()
 {
     $this->mailChimpService->initialize();
     parent::initializeAction();
 }